import { motion, useScroll, useSpring, useTransform } from 'framer-motion'; import { useRef } from 'react'; const MovingLine = () => { const transition = { duration: 14, ease: 'easeInOut', }; const ref = useRef(null); // Track scroll progress, lies between 0 and 1. const { scrollYProgress } = useScroll({ target: ref, offset: ['end end', 'start start'], }); // when scroll progress reached 1, path length becomes 0. const pathLengthValue = useTransform(scrollYProgress, [0, 1], [1, 0]); const PATH = 'M0.5 0.980671L0.5 1566.02'; return (
); }; { /* dummy content to fill up the screen */ } export const Content = () => { return (

The path follows the scroll

If you look closely, you can see the path is being animated.

); }; export default MovingLine;