Jump to content
Search Community

TimelineMax - Dynamic labels on insertMultiple

martis test
Moderator Tag

Recommended Posts

Hi guys,

 

I want to create 1 Master Timeline (MT) with multiple timelines sequenced within that MT.

 

I want to be able to jump between these nested timelines (skip forward and skip backward).

 

My question is:

 

How can I give each of them a label while still using insertMultiple to the MT so I can use getLabelAfter() and getLabelBefore()?

 

I have tried getActive() on the MT and tried restart/complete on the active timeline, but have had wonky results with future timelines running. I think the gotoAndPlayLabel would be the safest bet?

 

Thanks!

Link to comment
Share on other sites

My first round solution looks like this:

 


sequence = [moveRight, moveDown, expand];

for(var i:uint = 0; i < sequence.length; i++) {

				var label : String = TimelineMax(sequence[i]).vars.name;
				MT.addLabel(label, MT.duration);
				MT.insert(sequence[i], label);

		}

 

MT is my main timelinemax instance.

moveRight, moveDown, and expand are TimelineMax instances. I gave those instances names in the var object and used that to create frame labels...

 

It's working great so far, but any other methods are welcome. Thanks!

Link to comment
Share on other sites

Hi Martis, that solution looks real solid.

 

I don't think there is really an "official" way to do something like that, so if it works for you I would say stick with it.

 

I have 2 tutorials that might help you with navigating through TimelineMax based animation:

 

1: This tutorial is based on the way the greensock homepage animation was built with each section or slide of animation being in a separate class file. each section shares similar animateIn and animateOut methods so it makes it real easy to chain them all together into 1 sequence:

 

http://www.snorkl.tv/2011/05/real-world ... ase-study/

 

2: This tutorial focuses on adding really smooth transitions between sections.

http://www.snorkl.tv/2011/03/teaser-bul ... ansitions/

 

if you combined these 2 tutorials with your dynamic merge maneuver you could have something really neat.

Link to comment
Share on other sites

I have a neat little tip for you guys: if you insert() a tween/timeline and define a label (the 2nd parameter) but the label doesn't exist yet, it will automatically place that label at the end of the timeline and then insert the tween/timeline. So you could shorten your code to this:

 

sequence = [moveRight, moveDown, expand];

for(var i:int = 0; i        MT.insert(sequence[i], sequence[i].vars.name);
}

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