Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
determin1st

Timeline event callbacks (maybe add onPause/onStop)

Recommended Posts

Hello,

 

Do you think if it would be useful to add onPause/onStop event callback? So the state of timeline could be obtained more convenient way? Or maybe I miss something? States:

 

- never played

- playing

- paused/stopped/killed but not completed

- paused/stopped/killed and completed

 

 

 

 

Link to comment
Share on other sites

Thanks for the suggestion. 

I can see how there are cases where additional callbacks could be useful, but we really try to keep the API as lean as possible in terms of files size and performance. In addition to files and performance, when we add features there's usually a strong case to be made that involves both:

 

  •  something that is in high demand
  • can't be achieved with existing API methods

With methods like paused(), isActive(), progress() you can pretty much get any type of state info that you need.

 

In most cases where you want custom code to run whenever an animation is paused you can wire up a function like


 

function pauseAnimation(animation) {

  animation.pause();

 console.log("the animation has been paused");

//more custom code

}

then later

//pauseAnimation(intro)

//pauseAnimation(anotherAnimation)

 

On a larger scale you could use a more object-oriented approach where perhaps each animation is the property of an object and that object has custom methods for controlling its animations, firing events, clean up, and all that stuff.

 

Again, your suggestion is appreciated and valid. We always monitor how high the demand is for these types of things and your suggestions always help.

 

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