steve02x Posted July 23, 2020 Share Posted July 23, 2020 Hi Community! I was thinking about to start a normal gsap.timeline event(anim.play) with a ScrollTrigger onEnter callback. Is it possible to start an animation with it or should i track the user position with an extra javascript plugin and start it separately? best wishes, Steve. Link to comment Share on other sites More sharing options...
ZachSaucier Posted July 23, 2020 Share Posted July 23, 2020 Hey Steve and welcome to the GreenSock forums. I'm not really understanding your question. Can you please create a minimal demo and try to better explain your question/the situation? Link to comment Share on other sites More sharing options...
GreenSock Posted July 23, 2020 Share Posted July 23, 2020 @steve02x do you mean something like: let animation = gsap.timeline({paused: true}); tl.to(...); // add stuff ScrollTrigger.create({ onEnter: () => animation.play() }); ? If so, sure, but it'd probably be even easier to tap into toggleActions. The default toggleAction is to play() onEnter anyway. You can build it right into your timeline... let tl = gsap.timeline({ scrollTrigger: { trigger: "#id", toggleActions: "play none reverse none" } }); tl.to(...); // add animations See the docs for details: https://greensock.com/docs/v3/Plugins/ScrollTrigger 2 1 Link to comment Share on other sites More sharing options...
steve02x Posted July 23, 2020 Author Share Posted July 23, 2020 @GreenSock Hi Jack! Yes exactly! I tried the second one in my project but i made a mistake. I forgot to insert the "}" after the scrollTrigger implementation. Sorry Jack, its not my day. Such a simple thing 😴 Thank you for quick help and keep the great work up! Best wishes, Steve. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now