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