Jump to content
Search Community

Possible misunderstanding of Timeline mechanics

protoemocional test
Moderator Tag

Recommended Posts

Hello dear TweenMaxers and Greensock,

 

 

Once again I resort to you to... This time, I have some doubts on how to insert a TweenMax instance onto a Timeline without triggering its first position. Take for example this attachment, where I have described a LinePath2D with progress 0, inserting its Tween at frame number 5, yet it still renders its elements on stage, instantly.

 

Is there a way to inserting/appending/whatever Tweens without having to write action snippets on every desired frame, in order to not render a Tween's trajectory on the spot?

Link to comment
Share on other sites

This has nothing to do with the tween getting rendered immediately - it's just that you called line2d.distribute([h1]) right away which places h1 onto the path. If you want, I suppose you could wait to add h1 to the path like this (your code edited):

 

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.events.*;
import com.greensock.motionPaths.*;

var ninepoints:Array=[new Point(120,0),new Point(120,240)];
var line2d:LinePath2D=new LinePath2D(ninepoints);

var time:TimelineMax=new TimelineMax({useFrames:true});
time.insert(makeTween(), 5);

function makeTween():TweenMax {
var tween:TweenMax =  new TweenMax(line2d, 8.999999, {progress:1,
                                    												  ease:SteppedEase.create(8),
																					   immediateRender:false,
																					   delay:4} );
tween.addEventListener(TweenEvent.INIT, InitList);

return tween;
}

function InitList(e:TweenEvent):void {
e.target.removeEventListener(TweenEvent.INIT, InitList);
e.target.vars.progress=1;
line2d.addFollower(h1, 0);
trace("stay outside 'till I tell you");
}

 

Or you could just make your path extend 1 position up (off the stage). That would also solve your issue with having to make the tween's duration 8.999.

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