Universal Tween Engine v6.0.0 !

Dec 19, 2011 by     29 Comments    Posted under: Libraries, Universal Tween Engine


I just released the 6th major revision of the Universal Tween Engine. It is the most complete update of the engine ever. More than 50 commits, the whole engine was re-engineered.

I’m sorry for the users of the previous revisions, but the compatibility is broken. It was a requirement to push the library forward, and give it a real maturity. It is now much more robust and stable than before, and should work under every constraint. Don’t worry though, updating a project to this revision is not very difficult.

I updated the project wiki, go check the Get Started page ;-)

Also, in order to present the library to new users, I wrote a new page dedicated to it (also available by clicking on its banner on the front page of this blog). The page features two java applets that let you play with tweens and timelines (as illustrated on the right image), you should enjoy them.

Among the biggest changes, the engine now features zero dynamic allocation, tweens can be applied directly on your objects (without them implementing an interface), timelines (old groups) now support repeated tweens and nested timelines, yoyo style for repetitions was added, and callbacks were added to timelines too.

I hope you’ll enjoy it!

Description page: http://www.aurelienribon.com/blog/projects/universal-tween-engine/

Project page: http://code.google.com/p/java-universal-tween-engine/

Download page: http://code.google.com/p/java-universal-tween-engine/downloads/list

Changelog – 6.0.0

  • + Zero allocation! Use the engine safely in Android!
  • + Very robust engine, shouldn’t lost a single millisecond in updates.
  • + You can now apply tweens directly on your objects, there is no need that they implement some interface!
  • + As a result, the Tweenable interface is no more. It has been replaced by a TweenAccessor that can be registered statically to the engine.
  • + Repetitions can now be played in ‘yoyo’ mode: every odd iteration is played backwards.
  • + Callbacks were all changed, you have BEGIN, START, END, COMPLETE, and similar ones for backwards playing.
  • + TweenGroup is no more: welcome ‘Timeline’.
  • + Timelines can be repeated, yoyo style too.
  • + Nested timelines can be repeated too!
  • + Timelines now support callbacks! And all the callbacks used in Tween are working in Tiemlines!
  • + Several protections were added to prevent you from misusing the engine.
  • + Extensive javadoc was added to every public classes and methods!

29 Comments + Add Comment

  • Great!!!! i need to do an update from the svn repo!!!

  • Yes!!! you’re right, i realized that and then i downloaded the jars

    Are you working in the Universal Tween Studio?? I can not wait to see it and use it, off course.
    I’m a relative new developer in java technology. i’m from .NET world. I arrived in java to work in android games.
    One day, when i have more experience in java development, i’m going to help you with this projects, if you want.
    Regards and tnks

    PD: My english sucks, i know it xD

    • Your english is very well :)
      I’m currently porting the Studio to the tween engine 6, since many things changed. Once done, I’ll release a beta. Shouldn’t be in a long time.

  • Hey,
    I’m trying out this “engine”. But it doesn’t seem to work with Interface types?

    • You’re right, the engine only tests if your targets directly implement TweenAccessor or if their class or any parent class is registered with an accessor.

      I’ll add interface support: if any of the previous doesn’t match, the engine will iterate over the registered accessors and test your target with “instanceOf” calls.

      Will be available asap in repo, but official 6.1.0 release won’t come before the release of Tween Studio :)

    • That would be awesome!

    • btw,

      I have implemented a callback(onEvent(EventType e, BaseTween t)). While the method is called the source is always null?
      How come?

    • I could have opened a new ticket but:

      I debugged and noticed something odd.

      in BaseTween > method callCallbacks

      I noticed that the Source is always null.

      if (callbacks != null && !callbacks.isEmpty())
      for (int i=0, n=callbacks.size(); i<n; i++)
      callbacks.get(i).onEvent(type, null);

      Could this be the error?

    • Totally, à little mistakes of mine. Thanks for reporting ;-)

    • I just added a method to Tween.java:

      * Forces the tween to use the TweenAccessor registered with the given
      * target class. Useful if you want to use a specific accessor associated
      * to an interface, for instance.
      * @param targetClass A class registered with an accessor.
      * @return The current tween, for chaining instructions.
      public Tween as(Class targetClass);

      I uploaded a temporary 6.1.0-beta, can you test it and tell me if it solves your interface issue ?

      You need to add “.as(yourInterface.class)” to your Tween calls.

      This extra method is required since an object may implement multiple interfaces associated to different accessors. I may use “target.getClass().getClasses()” call to iterate over all the implemented interfaces and superclasses, but this call is forbidden when using a SecurityManager, and it won’t solve the issue of multiple interfaces associated to different accessors :)


    • Yes,

      A: The source now returns as should.
      B: Interfaces do work now. ( and you are right, without the “as” method it won’t accept the class type).


    • Thank you for testing! Official 6.1.0 will be out soon (as well as the Tween Studio) :)

  • This is really a nice engine and it is simple to use. Great job and thanks for sharing it with us.

    I have a question about the Timeline. It does not look like I can push tweens and timelines to a timeline once it is started. I think the ability to add more tweens while a timeline is running would be a great addition. In addition, it would be great if the timeline auto starts as we push more tweens to it once it started. However, I see how this might be problematic for beginSequence and beginParallel.

    • Thanks :)

      Indeed, timelines are sealed once started. I did not see a real use case to dynamic modification of a timeline, but if you have one, I’ll change this behavior, should be easy.

      What do you mean by “it would be great if the timeline auto starts as we push more tweens to it once it started” ?

  • Hi, congrats on tween engine.
    After updating the jar, i get an error on Tween.setPoolEnabled(true);
    Have you removed the method?


  • Hi,

    What’s happened to the primitive types like TweenableInt, TweenableFloat, etc…?
    Do i have to implement them using the TweenAccessor? :( :( :(


    • I removed them for 6.0.0, but they will be back in 6.1.0 (scheduled for this weekend). Sorry for the inconvenience, I first though that they were not really needed, but I sometimes use them myself, so I re-implemented them :p

  • Hi there,

    I’ve hg cloned the project and it’s now on version 6.1.0, but still no TweenableFloat or TweenabeInt…
    Are you really gonna include them on 6.1.0 version?


    • You’re right, and I’ll correct that as soon as possible (I’m a little overwhelmed by my day job currently). I’ll include them in 6.1.0 as promised, I just need to delay its release until I have some spare time back, sorry :)

  • Thanks for making this great engine, bookmarked!
    I like the fact that we call the update ourselves, I hate tweening engines doing their own business with time management.

    I found nothing about how to stop a tween though?
    I would like to interrupt a tween, and get a specific event, like “stopped” for example.

    • Thanks :)
      You’re looking for “tween.kill()”. However, this won’t fire any event, but I’ll add one in 6.1.0.
      You can also kill many tweens at once if you use a manager, with “manager.killXXX()”.

  • Hi there!

    Any news on Tween Engine?
    Still waiting for the primitive types… ;(


  • just dropped by to say: I’ve been using this library for the past two weeks and I’m very impressed. This is really well designed software, beautifully written and delivers great results!

  • Thank You for this .. Sir I’am newbie and i want to learn how to make it work this,
    can you give me some tutorial or guide i have learn libgdx .. and i want to make the cool effect like
    tween Engine ! How can i do that ?

    sorry for the noob question , but i’am willing to learn this cool effect THANK YOU

  • Hi Aurelien,

    How i can detect collision in my game animation made in tween engine, or how i can detect de position of actors


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>