feat: animate canvas backdrop changes

This commit is contained in:
Prayag Prajapati committed 2025-07-05 15:14:17 +05:30
1 parent 0cf87da218
commit a8ee9c190c
1 file changed
+25 -16
+25 -16
View File
@@ -1,3 +1,4 @@
import { AnimatePresence, motion } from "motion/react";
import React from "react"; import React from "react";
import { useShallow } from "zustand/shallow"; import { useShallow } from "zustand/shallow";
import { useBackdropStore } from "@/utils/store/backdrop"; import { useBackdropStore } from "@/utils/store/backdrop";
@@ -17,21 +18,29 @@ export default function Backdrop() {
} }
return ( return (
<div className="app-backdrop-container"> <AnimatePresence mode="sync">
<BlurhashCanvas <motion.div
blurhashString={backdropHash} initial={{ opacity: 0 }}
width={300} animate={{ opacity: 1 }}
height={150} key={backdropHash}
canvasProps={{ exit={{ opacity: 0 }}
style: { className="app-backdrop-container"
display: "block", >
width: "100vw", <BlurhashCanvas
height: "100vh", blurhashString={backdropHash}
margin: "0 auto", width={300}
filter: "brightness(0.8) contrast(1.6) saturate(1.6)", height={150}
}, canvasProps={{
}} style: {
/> display: "block",
</div> width: "100vw",
height: "100vh",
margin: "0 auto",
filter: "brightness(0.8) contrast(1.6) saturate(1.6)",
},
}}
/>
</motion.div>
</AnimatePresence>
); );
} }