Jump to content
Search Community

Timelinelite to stagger function calls on an array of objects.

bonassus test
Moderator Tag

Recommended Posts

I'm wondering if there is a way i can use Timelinelite and insertMultiple to stagger function calls on objects in an array maybe with dellaycall? Each object in the array has the same public start(); function. I could do this with the timer class and a loop but im wondering if there is a way to use timelinelite to have improved sequencing control. 

 

Sorry i don't have a code example of what im trying to do. 

 

Is this crazy talk or am is this a good idea?

 

thanks!

Link to comment
Share on other sites

Sure you could use the new add() method to add multiple, evenly-spaced callbacks to a timeline:

 

import com.greensock.*;


var tl = new TimelineMax({repeat:2, yoyo:true});

//there will be 1 second between each function call
tl.add([function1, function2, function3, function4], 0, "sequence", 1)


function function1(){
  trace("function1");
}


function function2(){
  trace("function2");
}


function function3(){
  trace("function3");
}


function function4(){
  trace("function4");
}

insertMultiple(), appendMultiple(), append() and insert() have been deprecated.

Lots of good stuff in the TimelineLite docs

Link to comment
Share on other sites

Thanks Carl,

 

You are always super helpful. I need to do some catching up as I was still using v.11

The .add() method looks very useful.

By the way I signed up for the talk you are giving next tuesday which is two blocks from my office. I'm looking forward to it, see you then.

 

B

  • Like 1
Link to comment
Share on other sites

  • 2 years later...

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