Text Animatinon
A timeline animation using Framer Motion that animates items one by one as you reach each specific section
A timeline animation using Framer Motion that animates items one by one as you reach each specific section
npm install framer-motion @motionone/utils
1import { motion, AnimatePresence, useInView } from 'framer-motion';23export const TimelineContent = ({4children,5animationNum,6timelineRef,7}: {8children: React.ReactNode;9animationNum: number;10timelineRef: React.RefObject<HTMLDivElement>;11}) => {12const sequenceVariants = {13visible: (i: number) => ({14filter: 'blur(0px)',1516y: 0,17opacity: 1,18transition: {19delay: i * 0.3, // Delay each item by 0.5s multiplied by its index20duration: 0.5, // Duration of the blur removal21},22}),23hidden: {24filter: 'blur(20px)',25y: 0,26opacity: 0,27},28};29const isInView = useInView(timelineRef, {30once: false,31// margin: '0px 0px 400px 0px',32});33return (34<>35<>36<motion.div37initial='hidden'38animate={isInView ? 'visible' : 'hidden'}39custom={animationNum}40variants={sequenceVariants}41>42{children}43</motion.div>44</>45</>46);47};
Prop | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | The content to be displayed within the timeline. | |
animationNum | number | The number of the animation sequence. | |
timelineRef | React.RefObject<HTMLDivElement> | A reference to the timeline element for manipulation. |