Jump to content
GreenSock

erikb

how to progress(1, false) but fire every callback along the way

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

Can I call progress to jump to the end of my tweenlite, but fire every callback and complete every embedded tween from where I am to the end?

 

The second parameter to progress is properly calling my tween's onComplete callback, but we are jumping over embedded tween's callbacks and behavior (which play and fire just fine when we are playing normally).

Link to comment
Share on other sites

I figured out what was going on, and regret taking your time.  Let me explain what I did in pseudo-code.  Hopefully it is helpful to someone else.

var myTL = new TimeLineLite( );
myTl.add( TweenLite( $('.something'), 10, {   
   opacity: 0,
   onComplete: function( ) {
      myTL.pause();
   }
}), 0 );
myTl.add( TweenLite( $('.something'), 10, {   
​   opacity: 1,
   onComplete: function( ) {
      console.log( "do I get called?" );
   }
}), 10 );
myTl.eventCallback( 'onComplete', function() {
   console.log( "all done!" );
});

myTl.progress( 1, false );

The pause in the first callback prevented the second callback ("do I get called?") from firing.  Confusing me was that the timeline's onComplete ("all done") was called.

Link to comment
Share on other sites

oops.

I worked up a quick demo illustrating that progress(1, false) will allow all callbacks to fire.

Perhaps it will help someone else in the future:

 

http://codepen.io/GreenSock/pen/pJojA

 

 

Glad you got it sorted 8-)

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