Тёмный

Complex Animations with Framer Motion & React || useAnimate Hook 

Tom Is Loading
Подписаться 22 тыс.
Просмотров 32 тыс.
50% 1

Animated UI components for React, Tailwind CSS, Framer Motion & More ✨ www.hover.dev
Framer Motion is my favorite animation library by a long shot (you know that by know if you watch my videos, I won't shut up about it lol).
That said, using normal motion components has a big downside.
Orchestrating complex animations is super annoying.
Fortunately, Framer Motion gives us a SUPER simple hook to fix this problem.
Today we'll learn how we can leverage the useAnimate hook to build complex, multi-step, multi-element animations with Framer Motion and ReactJS!
🔗 My Links
TikTok: / tomisloading
Instagram: / tomisloading
GitHub: github.com/Tom...
Twitter: / tomisloading
Discord & more: linktr.ee/tomi...
Portfolio templates: tomisloading.g...
Website: www.hover.dev

Опубликовано:

 

7 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 64   
@AaronHongry
@AaronHongry 4 месяца назад
Your videos are so well-paced while being so informative omg THANK YOU :>
@EricMalek
@EricMalek 9 месяцев назад
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 10 месяцев назад
This looks super cool and with your walkthrough works like a charm. Thank you so much for sharing!
@tomisloading
@tomisloading 10 месяцев назад
Happy it helped!! 😁😁
@yajirushik2871
@yajirushik2871 2 месяца назад
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!
@rohit_700
@rohit_700 10 месяцев назад
Oh God! This just made animating different components so easier....
@tomisloading
@tomisloading 10 месяцев назад
Agreed! So useful haha
@akshitagg1
@akshitagg1 8 месяцев назад
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?
@excalibur2417
@excalibur2417 6 месяцев назад
This is exactly what I needed for my project, thank you so much! Liked
@alexbx9
@alexbx9 4 месяца назад
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.
@wingmann3632
@wingmann3632 4 месяца назад
EXTREMELY COOL TUTORIAL, thank you)
@mdrifat6941
@mdrifat6941 10 месяцев назад
O my my.... Again thank you so very much for this video...💝💝
@SuperRockcore
@SuperRockcore 4 месяца назад
Thanks.. would never be able to figure this stuff out w/o ppl like you..
@ElNicopewpew
@ElNicopewpew 3 месяца назад
Great video! Im trying to connect the animation start to scroll but alas, no luck yet!
@goresometimes3528
@goresometimes3528 6 месяцев назад
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' }, }, };
@subhanshusj_jha4978
@subhanshusj_jha4978 10 месяцев назад
Brilliant explanation i am going to Use that in a project
@Siberian-Vladik
@Siberian-Vladik 19 дней назад
body, youre a living legend
@phuongwj
@phuongwj Месяц назад
BLESS YOU, THANK YOU SO MUCH!!!!!!
@duckyshorts89
@duckyshorts89 Месяц назад
Please what's the vs code theme you are using tell me
@crim-son
@crim-son 6 месяцев назад
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?
@itsdrvgo
@itsdrvgo 10 месяцев назад
The way he said, "Hello, this is my face"... I just burst into laughter... XD... Great video btw
@faisal_dev951
@faisal_dev951 10 месяцев назад
hahah same 🤣🤣
@tomisloading
@tomisloading 10 месяцев назад
LOOOOL 😂
@GooseGumlizzard
@GooseGumlizzard 6 месяцев назад
you're easily amused
@BasicallyBasics
@BasicallyBasics 5 месяцев назад
How to set Initial values? im trying to make a scale 0 to 1 to the div inside the sceropbut its not animating
@mohammad81295
@mohammad81295 7 месяцев назад
Awesome explanation, keep up the quality work
@tomisloading
@tomisloading 7 месяцев назад
Thank you! 😁
@MuhammadAlam-ne9cf
@MuhammadAlam-ne9cf 7 месяцев назад
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 6 месяцев назад
I figured it out: it turns out iphone browsers require SVGs to have an explicitly set width property. working now!
@temitopedavid9508
@temitopedavid9508 6 месяцев назад
Thanks so much tom🎉
@BooksWeCanRead
@BooksWeCanRead 10 месяцев назад
This is awesome! Thanks so much! 👏👏
@tomisloading
@tomisloading 10 месяцев назад
Happy to help :)
@bhaveshsaxena9724
@bhaveshsaxena9724 10 месяцев назад
It will be great if you make website using frame motion using multiple components
@tomisloading
@tomisloading 10 месяцев назад
I could do that!
@FelipeSilvaMedeiros
@FelipeSilvaMedeiros 9 месяцев назад
Great video and explanation. Thanks for share with us.
@tomisloading
@tomisloading 9 месяцев назад
Thank you!
@felipefregginrules
@felipefregginrules 18 дней назад
This is sooooo good 🎉
@fightscene817
@fightscene817 10 месяцев назад
Amazing explanation! Thank you
@tomisloading
@tomisloading 10 месяцев назад
Glad it was helpful! 😁
@Thomaskbird
@Thomaskbird 7 месяцев назад
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 7 месяцев назад
They can absolutely be within child components! 👍 as long as they’re rendered within the scope, they can be animated
@tamerahmed9860
@tamerahmed9860 10 месяцев назад
Great tutorial! Thank you 🙏
@tomisloading
@tomisloading 10 месяцев назад
You're very welcome! 😁😁
@sohrabkhan101
@sohrabkhan101 7 месяцев назад
How can we define initial state.
@kurtlee138
@kurtlee138 8 месяцев назад
Amazing stuff, thanks!
@abimbolapatrick2707
@abimbolapatrick2707 9 месяцев назад
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 8 месяцев назад
then call it in useEffect
@maduemeka6982
@maduemeka6982 6 месяцев назад
Thank you 💕
@michaelrooze278
@michaelrooze278 9 месяцев назад
Would you have to use forwardRef if passing to a component?
@labhamjain3915
@labhamjain3915 9 месяцев назад
For scope.current i guess
@deepagarwal2504
@deepagarwal2504 7 месяцев назад
Love your face tom, please show it mmore often
@user-ph5xo4bi7s
@user-ph5xo4bi7s 8 месяцев назад
thank you :)
@taravisser4713
@taravisser4713 10 месяцев назад
Thank you
@tomisloading
@tomisloading 10 месяцев назад
You’re welcome :)
@rubenn6160
@rubenn6160 10 месяцев назад
Wow muy buen video enserio, gracias por explicar este tema bien
@prashlovessamosa
@prashlovessamosa 10 месяцев назад
thanks for sharing
@tomisloading
@tomisloading 10 месяцев назад
Thanks for watching! 😁
@MDTalha-vt9bi
@MDTalha-vt9bi 7 месяцев назад
i like your code
@tomisloading
@tomisloading 7 месяцев назад
Thank you! :)
@pradeepkundekar07
@pradeepkundekar07 9 месяцев назад
Nice!
@gaborlakatos882
@gaborlakatos882 7 месяцев назад
cool
@loground
@loground 10 месяцев назад
Hey! Did text you in instagram dm and emailed about buying the subscription. Would truly appreciate the response. And thanks for the video again!
Далее
Staggered Text Animations with React and Framer Motion
11:59
The Framer Motion Scroll Animation Masterclass
9:23
Просмотров 27 тыс.
My Top 5 Techniques for Web Animation
9:58
Просмотров 84 тыс.
Webflow vs Framer: 2024 Guide for Web Designers
6:51
Framer Motion (React) - The Basics
17:07
Просмотров 28 тыс.
5 React Native Tips to WOW Your Users
16:36
Просмотров 22 тыс.
On-Scroll Reveal Animation with React & Framer Motion
10:39
Framer Motion (React Animation Library) Crash Course
1:12:31