Universal Tween Engine v5.0

Aug 29, 2011 by     1 Comment     Posted under: Libraries, Universal Tween Engine

Hello !

I recently released a major update to the Universal Tween Engine (if you wonder what is this lib, see this post). I broke the TweenGroup API, but with a good reason: groups now support nested sequences, and they are pooled (if Tween pool is activated).

Have a look at the following code snippet to understand how groups can be used to create complex and powerful sequences:

// Create some powerful animation sequences!
TweenGroup.sequence(
	TweenGroup.parallel(
		Tween.set(...),
		Tween.set(...),
		Tween.set(...)
	),

	TweenGroup.tempo(1000),

	Tween.to(...),
	Tween.to(...),
	Tween.to(...),

	TweenGroup.parallel(
		Tween.to(...),
		Tween.to(...),
		Tween.to(...),

		TweenGroup.sequence(
			Tween.to(...),
			Tween.to(...)
		)
	)
).addToManager(manager);

Otherwise, a ton of useful stuff was added to the Tween API. Besides the .target() method that is used to set the target value(s) of an interpolation, there is now the following ones:

  • .target(…): target values are the params
  • .targetRelative(…): target values are the params added to the start values (at start time, after delay)
  • .targetCurrent(): target values are the values at current time (ie. at method call time)
  • .targetCurrentRelative(…): target values are the params added to the values at current time (ie. at call time)

Also, I added a SimpleTweenable interface, that extends Tweenable. It should be used when you don’t care about tween types since there should only be one possible. I added implementations for primitive types, like TweenableInt, TweenableFloat, etc.

Have fun!

1 Comment + Add Comment

  • [...] menu has a little bounce animation on the buttons, that was built using Aurélien Ribon’s Universal Tween Engine. I’ve used that library in sCatter, and I wanted to play with the new version (which is just [...]

Got anything to say? Go ahead and leave a comment!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>