Jump to content
GreenSock

adsss666

Timelinelite.call() method not working for me

Go to solution Solved by adsss666,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi! 

 

So, using TimeLineLite, I'm trying to call a function before the end of the timeline.

 

Im using 

tl.call( KillBeforeEnd, [],  '-=5');

Up 'til when I use that, all previous tweens finish at 10 seconds

 

but my KillBeforeEnd function doesn't get called 5 seconds before the end, as I thought it should, it gets called after the 10 seconds.

 

Am I doing something stupid?

See the Pen meXPrJ by adsss666 (@adsss666) on CodePen

Link to comment
Share on other sites

You were just missing the "scope" parameter:

//BAD: 
tl.call( KillBeforeEnd, [],  '-=5');

//GOOD:
tl.call( KillBeforeEnd, [],  null, '-=5');

//ALSO GOOD (when you don't need to define parameters or scope):
tl.add( KillBeforeEnd, '-=5');

:)

 

http://greensock.com/docs/#/HTML5/GSAP/TimelineLite/call/

  • Like 3
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.
×