AnarchyPancake
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by AnarchyPancake
-
-
16 hours ago, Rodrigo said:
Hi and welcome to the GreenSock forums.
I'm not seeing any animation playing at any point. Also your sample doesn't have any scrolling available so we can't test that neither.
If you want to control the animation of the content of each tab, I'd suggest you to loop through those elements and create a Scroll Trigger for each one, also put each tab in it's own component in order to better control each one's Scroll Trigger instance.
Right now you're creating a scroll trigger for this selector:
animation1('.show .box')
, which is just the current active box and you're doing in it in a useEffect hook that runs on the main component's initial render.As I said, move each tab content element to it's own component and create the scroll trigger instance in there. Finally create some scrolling space on each one in order to see what is and is not working and why.
Unfortunately I don't have time right now to create a working sample for you, so hopefully this helps in some way.
Happy Tweening!!!
I made the suggested edits so that this will fire off on tab click but the onRefresh property, how can I restart/refresh the animation to fire again from a position of 0 upon the next tab click?
-
I am having trouble getting my ScrollTrigger animations to fire dynamic animations (those of which are housed in premade functions) that a user selects from a wysisyg on a tabbed template. My setup is using react in conjunction with the GSAP library and things are componentized so we don't really always know what's on the page so we need the component to be able to restart itself. The issue comes when I am trying to trigger the animation upon tab click. OnRefresh it would be great to key off the tab click to be able to restart the ScrollTrigger animation and have it actually only fire upon scrolling to the trigger start point. As it is now, it either restarts the animation upon tab click without waiting for me to scroll to the trigger as it should or like my codepen demo, it fires only once and none of the other elements (brightly colored boxes) animate after clicking the tab and scrolling to the trigger starting point.
See the Pen MWJEOYQ?editors=1111 by ashleigh (@ashleigh) on CodePen
How to get ScrollTrigger to refire dynamic animation on a tabbed template
in GSAP
Posted
Thank you for your advice, the only stitch in my actual setup as opposed to my codepen demo is that my tabs component is actually a completely separate app from the animation component. We are using a traditional multi-page CMS where these individual items are being rendered as separate apps, as per how our build works with the CMS. Is there a way to use the useref for the tabs app in the animation app to start and stop the animations as per your suggestion? Also this logic would need to live in the animation app due to our set up.