Thank you so much guys for the amazing support! Really appreciated. It makes us feel we have made the right choice of animation library
Here, we have created a pen where the code can be compiled: http://codepen.io/mothervolcano/pen/GggYog (thanks for showing it to us)
I have also included the real context we're using the tween. We're using it with paper.js.
The example provided by @Diaco.AW works like a charm and its exactly what we're trying to achieve.
But when applied exactly the same way to the paper.js object it behaves differently as you can see.
Just want to confirm with you that it is not something we're doing wrong with the tween before trying to find help in the paper.js forums.
paper.install(window)
paper.setup('myCanvas')
var size = new Size(50, 50);
var squareBlue = new paper.Path.Rectangle( { x: 100, y:150 }, size);
squareBlue.fillColor = 'blue';
var squareRed = new paper.Path.Rectangle( { x: 100, y: 200 }, size);
squareRed.fillColor = 'red';
var t1 = TweenMax.to( squareRed.position, 2, { y: "-=100" ,onOverwrite:report} );
var t2 = TweenMax.to( squareRed.position, 1, { y: "+=50", delay: 0.5 } );
var t3 = TweenMax.to( '.red', 2, { y: "-=100" ,onOverwrite:report} );
var t4 = TweenMax.to( '.red', 1, { y: "+=50", delay: 0.5 } );
function report() {
console.log("overwrite > t1 = " + t1.progress() );
}