diff --git a/src/components/GrayscaleTransitionImage.tsx b/src/components/GrayscaleTransitionImage.tsx index f9ede10..cdd86cd 100644 --- a/src/components/GrayscaleTransitionImage.tsx +++ b/src/components/GrayscaleTransitionImage.tsx @@ -4,31 +4,40 @@ import { useMotionTemplate, useScroll, useTransform, + useMotionValueEvent, + useMotionValue, } from "framer-motion"; import { Field } from "@atsnek/jaen"; +import { cn } from "@/lib/utils"; -const MotionImage = motion("img"); +const MI = motion.img; export function GrayscaleTransitionImage(props) { - let ref = useRef(); - let { scrollYProgress } = useScroll({ + let ref = useRef(null); + let { scrollYProgress, scrollY } = useScroll({ target: ref, offset: ["start 65%", "end 35%"], }); + + const value = useMotionValue(scrollYProgress); + let grayscale = useTransform(scrollYProgress, [0, 0.5, 1], [1, 0, 1]); let filter = useMotionTemplate`grayscale(${grayscale})`; return (
- - {/* */} + + + + > + +
); } diff --git a/src/templates/WorkTemplate.tsx b/src/templates/WorkTemplate.tsx index 3cbe02d..476519b 100644 --- a/src/templates/WorkTemplate.tsx +++ b/src/templates/WorkTemplate.tsx @@ -448,8 +448,8 @@ const Page: React.FC = withCMSManagement(() => {
-
- +
+