Hey @PointC
Thanks, this does indeed fix this particular issue, but the general issue is still unsolved, as my example was just a simplified test case. Take for example a timeline with more than two tweens:
var box = document.querySelector('.box');
var timeline = new TimelineMax({
repeat: -1
})
timeline.add(TweenMax.to(box, 1, {x: 0, y: 100}));
timeline.add(TweenMax.to(box, 1, {x: 50, y: 80}));
timeline.add(TweenMax.to(box, 1, {x: 100, y: 100}));
timeline.add(TweenMax.to(box, 1, {x: 150, y: 80}));
CodePen
The desired effect would be that once the box reaches the right side at the end of the timeline, it would then tween from *that* (150, 80) position back to the (0, 100) position, rather than tweening from the *original* (0, 0) position to the (0, 100) position.
Here's an example that correctly shows the effect I'm going for, created without using Timeline. As you can see, it's quite cumbersome:
var box = document.querySelector('.box');
doAnimation();
function doAnimation() {
TweenMax.to(box, 1, {x: 0, y: 100, onComplete: function() {
TweenMax.to(box, 1, {x: 50, y: 80, onComplete: function() {
TweenMax.to(box, 1, {x: 100, y: 100, onComplete: function() {
TweenMax.to(box, 1, {x: 150, y: 80, onComplete: function() {
doAnimation();
}});
}});
}});
}});
}
CodePen
Is there any way to represent that code with Timeline?