Share Posted July 26, 2015 Timeline tlA translates a rectangle horizontally three times, with constant acceleration across all three.When tlA completes, tlB is supposed to translate the rectangle once vertically.The sequence works properly only if I provide a position value for tlB. The value 2.5 was determined by trial and error.The issue remains if they are made children of a parent timeline.The repeat value will be a variable provided by the user. This means that the position value for tlB will vary and needs to be determined in code. How can the position value be determined elegantly?Thank you,Gus var rect:Sprite = new Sprite; rect.graphics.beginFill(0xFF0000); rect.graphics.drawRect(50, 75, 50, 50); // x, y, width, height rect.graphics.endFill(); addChild(rect); var tlA:TimelineMax = new TimelineMax(); var tlB:TimelineMax = new TimelineMax(); TweenMax.to(tlA, 5, { timeScale:20 } ); tlA.repeat(2); tlA.to(rect, 5, { x:400 } ); tlB.to(rect, 5, { y:200}, 2.5 ); // 2.5 is trial and error value Link to comment Share on other sites More sharing options...
Share Posted July 26, 2015 If your goal is to make tlB start when tlA finishes, why not just use an onComplete on tlA? Or you could add the "y" tween directly into tlA and use an onStart that kills the timeScale tween and sets the timeScale back to 1. You may be approaching this in a way that makes it a bit too complex when that's not really necessary. Then again, I may be misunderstanding your question 1 Link to comment Share on other sites More sharing options...
Author Share Posted July 27, 2015 TweenMax.to(tlA, 5, { timeScale:20 } ); tlA.add(TweenMax.to(rect, 5, { x:400, repeat:2, onComplete:timelineB } )); function timelineB():void { tlB.to(rect, 5, { y:200 } ); } Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now