Jump to content
Search Community

ScrollTrigger Reverse after morphing using another timeline

hamsa@thoughtput.in test
Moderator Tag

Recommended Posts

Hello folks!

 

I have a mostly simple setup here: timeline TL1 is triggered via ScrollTrigger which also displays a button. Clicking the button morphs the graphic to another shape via timeline TL2. Now I have onLeaveBack under ScrollTrigger's toggleAction set to reverse, and since I'm morphing using a variable, I'd image reverse works on the current shape. However what I'm seeing is onLeaveback revert to the previous shape right before reversing. I even tried to refresh() the ScrollTrigger, but to no avail. What am I missing here? Or is the only way out to use onLeaveBack to trigger a third timeline altogether?

 

Thanks for all the great work y'all are doing out here! 🙂

 

See the Pen eYZmEMm by ashwinuae (@ashwinuae) on CodePen

Link to comment
Share on other sites

Hey @hamsa@thoughtput.in,

 

You could e.g. use a function with the relevant params.
This can then be called with the corresponding callbacks (onEnter, onLeave, onEnterBack, onLeaveBack, ...) - and also for the click func.

 

See the Pen bGpNYoR by mikeK (@mikeK) on CodePen

 

Happy switching ...

Mikel

 

EdiT: I also changed the SVG: you might like the morph

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...