Complex Animations with Framer Motion & React || useAnimate Hook

Поделиться
HTML-код
  • Опубликовано: 27 дек 2024

Комментарии •

  • @2minutesoffun
    @2minutesoffun Месяц назад +1

    You are AMAZING!!! Not even a seasoned pro who boasts to be in the web dev domain for the past 30 yrs could explain this as smoothly as you did.You are a gift from above!!!

  • @AaronHongry
    @AaronHongry 8 месяцев назад +3

    Your videos are so well-paced while being so informative omg THANK YOU :>

  • @akshitagg1
    @akshitagg1 11 месяцев назад +2

    hey this(useAnimate hook) is not working if the children are dynamically generated like after fetching from API and then mapping so is there a way to make it work?

  • @MuhammadAlam-ne9cf
    @MuhammadAlam-ne9cf 10 месяцев назад +1

    Tom, I used this to create an animation sequence I have been thinking about for a long time. It worked so perfectly, but when I deployed to prod I realized none of this worked in a mobile browser on my iphone and ipad :( i had to revert back to using a much simpler animation with just motion components with initial/animate/transition props (which worked just fine on iOS chrome and safari browser). Any idea what I might be doing wrong?

    • @MuhammadAlam-ne9cf
      @MuhammadAlam-ne9cf 10 месяцев назад +2

      I figured it out: it turns out iphone browsers require SVGs to have an explicitly set width property. working now!

  • @goresometimes3528
    @goresometimes3528 10 месяцев назад

    How would you incorporate staggerChildren into this and make it so that one set of animations triggers after another? I have these four variants and I'd like the sentence and letter variants to run and then the container and item variants to run after.
    Variants -
    const sentence = {
    hidden: { opacity: 0 },
    visible: {
    opacity: 1,
    transition: {
    delay: 0.2,
    staggerChildren: 0.05,
    },
    },
    };
    const letter = {
    hidden: { opacity: 0 },
    visible: {
    opacity: 1,
    transition: { duration: 0.5, ease: 'easeInOut' },
    },
    };
    const containerVariants = {
    hidden: { opacity: 1 },
    visible: {
    opacity: 1,
    transition: {
    staggerChildren: 0.5,
    },
    },
    };
    const itemVariants = {
    hidden: { opacity: 0 },
    visible: {
    opacity: 1,
    transition: { duration: 2, ease: 'easeInOut' },
    },
    };

  • @EricMalek
    @EricMalek Год назад +1

    Thanks for this man! Since I discovered Framer Motion, I prefer it over GSAP. Too many steps to get GSAP to work and if you don't set it up right, it runs through all it's nodes before loading. That's a bad look for a developer...

  • @naylord5
    @naylord5 Год назад +9

    This looks super cool and with your walkthrough works like a charm.
    Thank you so much for sharing!

  • @BasicallyBasics
    @BasicallyBasics 9 месяцев назад

    How to set Initial values?
    im trying to make a scale 0 to 1 to the div inside the sceropbut its not animating

  • @rohit_700
    @rohit_700 Год назад +2

    Oh God!
    This just made animating different components so easier....

  • @excalibur2417
    @excalibur2417 9 месяцев назад +1

    This is exactly what I needed for my project, thank you so much! Liked

  • @duckyshorts89
    @duckyshorts89 5 месяцев назад

    Please what's the vs code theme you are using tell me

  • @Patoricko2
    @Patoricko2 Год назад

    Do we need to always use a function to trigger the animations?
    How do i trigger series of animation once my page refreshes?

    • @zulhamsy
      @zulhamsy 11 месяцев назад

      then call it in useEffect

  • @michaelrooze278
    @michaelrooze278 Год назад

    Would you have to use forwardRef if passing to a component?

  • @crim-son
    @crim-son 10 месяцев назад

    Awesome video🎉🎉, pls is there a way to make offsets between the timelines? Like if you want the toggle button to animate sooner than it should,
    Or how to make two animations run concurrently?

  • @waggadash
    @waggadash 2 месяца назад +1

    Appreciate it! Very well done, thanks Tom :D

  • @alexbx9
    @alexbx9 7 месяцев назад

    I appreciate you making these videos, because you explain things very well. However, I have a question: How can I run two animations simultaneously in an animation sequence and then continue the sequence? Do I skip the await for one of them? Or what is the best way to do this? This is how I did it before.
    const sequence: AnimationSequence = [
    ['.animated__gallery-text', { opacity: 1 }, { duration: 0.8 }],
    ['.galleryt-1', { opacity: 0, maxHeight: 0 }, { duration: 1 }],
    ['.galleryt-2', { opacity: 1 }, { duration: 1 }],
    /*these should play simultaneously*/
    ['.animated__gallery-text', { height: '100px' }, { duration: 1 }],
    ['.galleryt-2', { fontSize: '30px' }, { duration: 1, delay: -1 }],
    /*and this should play after them*/
    ['.galleryt-2', { color: "red" }, { duration: 1}],
    ];
    useEffect(() => {
    animate(sequence);
    }, []);
    So, with your version, it would look like this? Is this correct?
    So, for the animations that I want to run simultaneously, I should remove the await from all of them except the last one, right?
    const handleAnimate = async () => {
    await animate('.animated__gallery-text', { opacity: 1 }, { duration: 0.8 });
    await animate('.galleryt-1', { opacity: 0 }, { duration: 1 });
    await animate('.galleryt-2', { opacity: 1 }, { duration: 1 });
    animate('.animated__gallery-text', { height: '100px' }, { duration: 1 });
    await animate('.galleryt-2', { fontSize: '30px' }, { duration: 1 });
    await animate('.galleryt-2', { rotate: 40 }, { duration: 1 });
    await animate('.galleryt-1', { opacity: 1 }, { duration: 1 });
    };
    useEffect(() => {
    handleAnimate();
    }, []);
    Thank you so much in advance.

  • @yajirushik2871
    @yajirushik2871 6 месяцев назад +3

    I have wrote many animations with different ways, from transition / keyframes in basic CSS to GSAP and React Transition Group.. but.. the Framer Motion approach with useAnimate in my opinion is the best!

  • @Thomaskbird
    @Thomaskbird 11 месяцев назад

    Hey great video, I recently have been experimenting with motion and had the same exact feelings of how complex using motion components can be for very complex animation sequences or where you’d like some animations to be dependent on others. So this useAnimate hook demo is great, but I’m assuming this would only work if all elements that you’d like to animate are within the single component vs a bunch of child components or does that also work?

    • @tomisloading
      @tomisloading  11 месяцев назад

      They can absolutely be within child components! 👍 as long as they’re rendered within the scope, they can be animated

  • @temitopedavid9508
    @temitopedavid9508 10 месяцев назад +1

    Thanks so much tom🎉

  • @ElNicopewpew
    @ElNicopewpew 7 месяцев назад

    Great video! Im trying to connect the animation start to scroll but alas, no luck yet!

  • @wingmann3632
    @wingmann3632 8 месяцев назад +1

    EXTREMELY COOL TUTORIAL, thank you)

  • @mohammad81295
    @mohammad81295 11 месяцев назад +1

    Awesome explanation, keep up the quality work

  • @sohrabkhan101
    @sohrabkhan101 11 месяцев назад

    How can we define initial state.

  • @subhanshusj_jha4978
    @subhanshusj_jha4978 Год назад +1

    Brilliant explanation i am going to Use that in a project

  • @Siberian-Vladik
    @Siberian-Vladik 4 месяца назад +1

    body, youre a living legend

  • @SuperRockcore
    @SuperRockcore 8 месяцев назад +1

    Thanks.. would never be able to figure this stuff out w/o ppl like you..

  • @tamerahmed9860
    @tamerahmed9860 Год назад +1

    Great tutorial! Thank you 🙏

  • @bhaveshsaxena9724
    @bhaveshsaxena9724 Год назад +2

    It will be great if you make website using frame motion using multiple components

  • @mdrifat6941
    @mdrifat6941 Год назад +2

    O my my.... Again thank you so very much for this video...💝💝

  • @BooksWeCanRead
    @BooksWeCanRead Год назад +2

    This is awesome! Thanks so much! 👏👏

  • @fightscene817
    @fightscene817 Год назад +1

    Amazing explanation! Thank you

  • @FelipeSilvaMedeiros
    @FelipeSilvaMedeiros Год назад +1

    Great video and explanation. Thanks for share with us.

  • @kurtlee138
    @kurtlee138 Год назад +1

    Amazing stuff, thanks!

  • @deepagarwal2504
    @deepagarwal2504 11 месяцев назад +1

    Love your face tom, please show it mmore often

  • @nikolas4749
    @nikolas4749 2 месяца назад

    Great video
    On you website you have a wet paint button dripping
    Could you make a video on how you do it ?

  • @maduemeka6982
    @maduemeka6982 9 месяцев назад +1

    Thank you 💕

  • @phuongwj
    @phuongwj 5 месяцев назад +1

    BLESS YOU, THANK YOU SO MUCH!!!!!!

  • @felipefregginrules
    @felipefregginrules 4 месяца назад +1

    This is sooooo good 🎉

  • @אילוןמעיין
    @אילוןמעיין Год назад +1

    thank you :)

  • @taravisser4713
    @taravisser4713 Год назад +1

    Thank you

  • @MDTalha-vt9bi
    @MDTalha-vt9bi 11 месяцев назад +1

    i like your code

  • @prashlovessamosa
    @prashlovessamosa Год назад +1

    thanks for sharing

  • @rubenn6160
    @rubenn6160 Год назад

    Wow muy buen video enserio, gracias por explicar este tema bien

  • @itsdrvgo
    @itsdrvgo Год назад +5

    The way he said, "Hello, this is my face"... I just burst into laughter... XD... Great video btw

  • @developer00007
    @developer00007 Год назад

    Nice!

  • @gaborlakatos882
    @gaborlakatos882 10 месяцев назад

    cool

  • @loground
    @loground Год назад

    Hey! Did text you in instagram dm and emailed about buying the subscription. Would truly appreciate the response. And thanks for the video again!