Skip to content
August 29, 2011 / Aurélien Ribon

Universal Tween Engine v5.0

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!

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s