const containerRef = useRef<HTMLDivElement>(null);
const targetRef = useRef<HTMLDivElement>(null);
const reducedMotion = useReducedMotion();
const { scrollYProgress } = useScroll({
container: containerRef,
target: targetRef,
offset: ["start end", "center center"],
});
const scale = useTransform(scrollYProgress, [0, 1], [0.86, 1]);
const opacity = useTransform(scrollYProgress, [0, 1], [0.4, 1]);
return (
<div ref={containerRef} className="h-[380px] overflow-y-auto">
<motion.div
ref={targetRef}
style={reducedMotion ? { scale: 1, opacity: 1 } : { scale, opacity }}
/>
</div>
);