Jump to content
Search Community

Problem with ScrollTrigger timeline onComplete

aijololo test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

  • Solution

Hi and welcome to the GreenSock forums.

 

The issue is that right now you're executing the function, so as soon as the browser gets to that part of the code the playSound function is executed.

 

GSAP has an excellent callback system that allows you to pass parameters, set scope, etc. This should work as expected:

tl.to("#knapp", {
  background: "#a6a6a6",
  onComplete: playSound,
  onCompleteParams: ["knapp0"]
});

Here you can learn more about callbacks, just scroll down to the Special Properties section:

https://greensock.com/docs/v3/GSAP/gsap.to()

 

Happy Tweening!!!

  • Like 4
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...