Jump to content
Search Community

Is it true? two different timelines can't share a sprite?

adventmedia test
Moderator Tag

Recommended Posts

Weirdness: Tried to create two different TimeLineLite timelines for a sprite.

 

_mainAnim is added to another timeline, _myAnim is on its own.

 

_mainAnim = new TimelineLite();

_mainAnim.add(TweenMax.from(this, .5, {scrollRect:{y:height}}));

_mainAnim.add(TweenMax.from(_counter, .3, {scrollRect:{x:_counter.width}}));

_mainAnim.add(TweenMax.from(bg, .5, {scaleX:0}));

 

_myAnim = new TimelineLite({onStart:playing, onComplete:playDone});

_myAnim.add(TweenMax.from(this, .5, {alpha:0}));

 
But when I play _mainAnim, the events for _myAnim fire!
Other oddities: unable to play _mainAnim at all (the sprite just disappears) - presumably this is verboten once it's added to another timeline?
And likewise, if _myAnim is assigned the same TweenMax animations (to duplicate the total animation), the sprite just disappears when _myAnim is played.
 
Basically I want to be able to play the same animation for the sprite - once as part of the animation timeline created for the parent view, and later on its own. Any way to do this?
 
Link to comment
Share on other sites

hard to tell without a demo, but by just going by your code it appears that both timelines are just starting at the same time. I have no evidence that either is paused.

I can say with absolute certainty that animating timeline A will never cause events in timeline B to fire (unless B is nested in A). Also animating a sprite in timeline A that also lives in timeline B will not cause any events to fire either. 

 

You can have Sprite1 in TimelineA and TimelineB, but you will have problems if both timelines try to animate the same properties of Sprite1 at the same time.

 

When using multiple from() tweens on the same object you need to be careful of how immediateRender works.

Here is a video from the HTML5 side but the same concepts apply: http://greensock.com/immediateRender

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