Skip to content
May 2, 2011 / Aurélien Ribon

Universal Tween Engine: rev 4.2

Hi there,

I released a new version of the Tween Engine. It mostly features facilities to handle overwriting tweens.


+ Added “boolean contains(Tweenable target)” to
+ Added “boolean contains(Tweenable target, int tweenType)” to
+ Added “void kill(Tweenable target)” to
+ Added “void kill(Tweenable target, int tweenType)” to
+ Added “Tween[] getTweens(Tweenable target)” to
+ Added “Tween[] getTweens(Tweenable target, int tweenType)” to

It is now easy to manually manage overwriting tweens. I tried to add an automatic support for overwrites, but I always found corner-cases in my own games where such automatic management would be more a pain than a gift. Therefore, I removed it.

Usage example:

// 1. Kill every tween associated to a type used in the
//    sequence below.

tweenManager.kill(tweenSprite, TweenSprite.ROTATION);
tweenManager.kill(tweenSprite, TweenSprite.OPACITY);
tweenManager.kill(tweenSprite, TweenSprite.POSITION_XY);
tweenManager.kill(tweenSprite, TweenSprite.SCALE_XY);

// 2. Add the new sequence safely.

tweenManager.add(new TweenGroup().pack(
	Tween.set(tweenSprite, TweenSprite.ROTATION)...,
	Tween.set(tweenSprite, TweenSprite.OPACITY)...,
	Tween.set(tweenSprite, TweenSprite.POSITION_XY)...,
	Tween.set(tweenSprite, TweenSprite.SCALE_XY)...,, TweenSprite.OPACITY, 1000, Sine.INOUT)...,, TweenSprite.SCALE_XY, 1000, Quart.INOUT)...,, TweenSprite.POSITION_XY, 1000, Elastic.OUT)...,, TweenSprite.ROTATION, 800, Cubic.INOUT)...

Tell me if you need other methods. I wondered if I should add some overloads to the methods from the changelog, in order to handle more than one tween type at once. However, that would require variable arguments, and thus allocation. I could also go the flag way, but tween types would need to be powers of two…

Anyway, have fun with this release :)

PS: someone in the tween engine google group asked me how to add tween support to a java Swing GUI. The test executable now provides such feature, as well as the game example. I still need to produce a real eye-candy demo with the game backend :)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s