Jump to content
GreenSock

erikb

immediate onStart?

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

Is there a way to have my onStart function fired immediately when I play() my tween?

Currently it looks like it waits until the next tick and gets fired via _internals.lazyRender.

 

Thank you for your help!

 

Link to comment
Share on other sites

Hi Erik,

 

I believe this has to do with the lazy rendering introduced in version 1.12. This basically "delays" the rendering until the end of the current tick.

 

Perhaps you could try using lazy:false in the config object in order to disable the lazy rendering for that particular instance, or if you're using a timeline use  a set() or call() instance, basically anything that is immediately rendered.

TweenLite.to(target, 1, {vars, lazy:false});

You can check more about it here:

 

http://greensock.com/gsap-1-12-0

  • Like 1
Link to comment
Share on other sites

Yep, Rodrigo is correct. There are actually three ways I can think of to do it:

// 1) Force a render *after* you create your tweens:
TweenLite.render();

// 2) Set lazy:false on the tween:
TweenLite.to(target, 1, {x:100, lazy:false});

// 3) Force the tween past its start point and back again:
var tween = TweenLite.to(...);
tween.progress(1).progress(0);
  • Like 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.
×