Jump to content
GreenSock

Hippiesvin

TimelineMax - how to call with each element?

Recommended Posts

Hi

 

I wonder if there is a way to make a call onStart with the element getting animated.

 

/HippieSvin

var arr:Array =[classWithOtherStuff,classWithOtherStuff,classWithOtherStuff];

var tm:TimelineMax = new TimelineMax();
tm.staggerFrom(arr, 0.5, { delay:0, y:'200', ease:Quad.easeOut, onStart:ElementInArr.doSomething}, 0.1);
Link to comment
Share on other sites

Thanks Carl.
Have used many well spended hours on snorkl.tv through the years, so thanks for what you've done there too :)

The use of {self} was new to me, is there any documentation on that way of doing it?

Link to comment
Share on other sites

Thanks for the nice words. You're welcome!

 

On the v12 page: http://www.greensock.com/v12/ Check out the Top 10 Improvements #10.

It shows how to get the target and time() of a tween via an onUpdate callback.

 

In the docs we mention the "{self}" thing when we discuss call back parameters like:

 

  • onComplete : Function - A function that should be called when the tween has completed
  • onCompleteParams : Array - An Array of parameters to pass the onComplete function. For example, TweenLite.to(mc, 1, {x:100, onComplete:myFunction, onCompleteParams:[mc, "param2"]}); To self-reference the tween instance itself in one of the parameters, use "{self}", like: onCompleteParams:["{self}", "param2"]

So it is in there but it probably won't jump out at you on first pass.

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