Jump to content
Search Community

TweenMax global callback

OxXxigen test
Moderator Tag

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

No, not easily. Keep in mind that the engine creates tweens via tons of methods: to(), from(), fromTo(), staggerFrom(), staggerFromTo(), so this type of change would have to happen somewhere in the core. It is possible that you could extend the base Animation class or TweenLite and try to add that functionality.


If you need a simpler and less flexible implementation you could create your own helper function that gives your to() tweens an onComplete or onStart like:


to(".green", 1, {opacity:0})
to(".orange", 1, {opacity:0, delay:1})
to(".grey", 1, {opacity:0, delay:2})

function to(target, duration, vars){
  var t =TweenMax.to(target, duration, vars);
  t.eventCallback("onComplete", logIt)

function logIt() {
  console.log("a tween has finished", this.target[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.
  • Create New...