tween.js r10

The usual tween.js release date is on the fourth of each month, so this release happening on the third is a bit weird, isn't it? Well, not really, as it's Sunday, and when I have time to do the release tomorrow --in the evening-- I might be a bit sleepy already and might not be as alert as I'd wish to be, so since there weren't any more new features to test and the release was ready, well... why wait until tomorrow when we can have it today?

So here's it: tween.js revision 10!

Featuring the astonishing amount of ONE NEW FEATURE!!

Amazing, isn't it??

(Waits for everyone to pick their jaws from the floor)

But what a feature, as you can now perform relative tweens. What that means, in other words, is that you don't have to know the absolute final values your object will have at the end of a tween if you don't want to.

Or, to put in some illustrative code, you can now do this:


new TWEEN.Tween( { x: 0, y: 0 } )
    .to( { x: '+10', y: '-10' }, 1000 )
    .start();

and the object will end up with these values:


{ x: 10, y: -10 }

Things get even more interesting when you combine this with the repeat feature, as you can have an object change its values several times using relative amounts, and you don't have to worry about using any sort of onStart function to set the desired starting values before the tween runs. To see an example that combines repeat and relative values, have a look at the 09_relative_values.html example.

Many thanks to endel, who contributed the feature and even added tests and ensured he didn't break any existing code. Brilliant!

Happy tweening!