Jump to content
Search Community

onComplete with Transform Matrix

MarkFromOP test
Moderator Tag

Recommended Posts

I know I am missing something here, can I have an onComplete call in a Trasform Matrix tween?

 

Here is what I have

 

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.TweenPlugin;
import com.greensock.plugins.TransformMatrixPlugin;
TweenPlugin.activate([TransformMatrixPlugin]);

 

TweenMax.to(mc, 2, {transformMatrix:{rotation:-15, ease:Quad.easeInOut, onComplete:myFunction}});

 

The tween works nicely but just dead ends on the end never calling myFunction

Link to comment
Share on other sites

You can absolutely do this; you just have a small nesting issue with your properties:

// Bad - has ease and onComplete inside the transformMatrix properties
TweenMax.to(mc, 2, {transformMatrix:{rotation:-15, ease:Quad.easeInOut, onComplete:myFunction}});
 
// Good - tween has three properties: transformMatrix, ease and onComplete
TweenMax.to(mc, 2, {transformMatrix:{rotation:-15}, ease:Quad.easeInOut, onComplete:myFunction});

If you find managing braces is too fiddly, you could always spread the properties over multiple lines:

TweenMax.to(mc, 2, {
  transformMatrix:{
    rotation:-15
  },
  ease:Quad.easeInOut,
  onComplete:myFunction
});
  • 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...