feat: animate canvas backdrop changes
This commit is contained in:
1 file changed
+25
-16
@@ -1,3 +1,4 @@
|
||||
import { AnimatePresence, motion } from "motion/react";
|
||||
import React from "react";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
@@ -17,21 +18,29 @@ export default function Backdrop() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="app-backdrop-container">
|
||||
<BlurhashCanvas
|
||||
blurhashString={backdropHash}
|
||||
width={300}
|
||||
height={150}
|
||||
canvasProps={{
|
||||
style: {
|
||||
display: "block",
|
||||
width: "100vw",
|
||||
height: "100vh",
|
||||
margin: "0 auto",
|
||||
filter: "brightness(0.8) contrast(1.6) saturate(1.6)",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<AnimatePresence mode="sync">
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
key={backdropHash}
|
||||
exit={{ opacity: 0 }}
|
||||
className="app-backdrop-container"
|
||||
>
|
||||
<BlurhashCanvas
|
||||
blurhashString={backdropHash}
|
||||
width={300}
|
||||
height={150}
|
||||
canvasProps={{
|
||||
style: {
|
||||
display: "block",
|
||||
width: "100vw",
|
||||
height: "100vh",
|
||||
margin: "0 auto",
|
||||
filter: "brightness(0.8) contrast(1.6) saturate(1.6)",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user