About the Tween Engine demo

In the previous post, I said that I completely changed the test desktop application of the tween engine. I’ll be more precise here.

Actually, I made a demo environment which lets me easily add demonstrations of the new features I may add to the engine. The application is composed of a launcher with multiple tiles (yes, I was inspired by the recent release of Windows8 consumer preview). Each tile is clickable, and will open a scene demonstrating a feature of the engine. Of course, every single animation, from the introduction screen to the launcher and the tests, is done with the tween engine. And, as always, the rendering process is backed with the all-mighty libGDX library.

Who says libGDX, also says desktop-to-android in a few seconds. Therefore, it would have been fool to miss the opportunity to bring the demo to android devices. If you want to test it, the application is now available on Google Play, for easier downloading.

Moreover, I was suspecting that, but now I’m sure: Mario Zechner, main developer of libGDX, can cast magic. Guess what? Desktop-to-web is now a reality, and again in a few seconds. Thanks to the GWT library, and the WebGL technology, libGDX powered apps can be converted to full html5+javascript, directly from your java code. You can try the demo on this page, all you need is a browser supporting WebGL (I know Google Chrome does). Hats off to you, Mr. Zechner.


Project page (with api + source + demo source)

Google Play page

Html5 page
Note: use ESC key to go back to the launcher from a test

33 Comments + Add Comment

  • On chrome 17 in Ubuntu 11.10 the webGL demo says webGL is not supported by the browser, even though it can successfully run webGL demos.

    • Yep, seems the GWT backend of libgdx does not support every webgl compatible browser. However, I used an alpha version of this backend, so I’m sure it has improved since then. I just did that as a proof of concept :)

      • I love those shots, sis! The sunrise show the maieifgcnnt creations of God! How wonderful that you got to worship Him in the grandiose scene! Thanks for linking this to BPC!

      • I don’t think you can find them at those Vietnamese Asian stores .. The Sunnybank area has a larger variety of Asian cooking products.. I get mine from market square alternatively there is a large abundance of Japanese goods at Helensvale near harbour town if you’re ever down that way!Thanks for visiting !

      • I get the problem that this video will not play… just reinstalled and rebooted three times, did reg clean, defrag etc… The weird thing is that the home page video works, also other peoples videos work, but that links in the right hand column from this video don’t… I am worried it is a Java bug in chrome or something, as it seems that it is the playlist of your uploaded videos that isnt working.

      • Hola perros, gracias x alegrarme el dia!!!!!Soy hermano no de sangre pero si del corazon de Leo el chico q hablo primero q llego ayer a bcn, el miercoles a la noche lo fui a despedir a ezeiza y hoy escucharlo desde bcn mandando sldos me partio al medio, se me cayeron un par lagrimas, muchas gracias!!!!!Les queria pedir si hay alguna posibilidad de bajarme el videito p/ tenerlo de recuerdo, gracias, los escucho todos los dias, son unos fenomenos!!!!!! Aguante perros!!!!!!!

  • Hi,

    Congratulations. I love your library because is very powerful, and is similar to iTween (http://itween.pixelplacement.com/) for Unity3D (the main idea).

    I am having a lots of problems with Android I implemented the example and the library works but no correctly (setValues is not called, getValues only once, I try using a simple loop with sleep…) I am sure that something is worng, therefore I try to download the source code of this demo, but I can’t find it in the main webpage.

    Thanks for post a solution ;)

    • You’re trying to use it in an android application or an android game?
      Your issue makes me believe that you don’t update the tween manager in an infinite loop.

      The complete source code of the demo is available here.

      Try to reduce your issue into an SSCCE so I can help you more :)

      • Ok thanks for the link :)

        I am trying your library in android application. I created a special loop for check that everything are correct:

        int lastMillis = 0;
        for(int i = 0; i<5; i++) {

        int deltaMillis = (int) (System.currentTimeMillis() – lastMillis);

        Log.d("loop", "loop");
        try {
        } catch (InterruptedException e) {

        If this issue persists I put more information in the official forum in Google Code.


        • The reason is that the first deltaMillis will be equals to System.currentTimeMillis(), which is more than huge, and will terminate the tween instantly.

          Several things need to be changed in your code:

          - lastMillis has to be initialized to the current time, not 0,
          - You never update lastMillis,
          - lastMillis has to be declared as long, otherwise the delta will always be huge

          See this for the correct code: http://pastebin.com/9CYVezSR

          • Thanks Aurelien, now all works perfectly. I can print some values and apparently all is correct.

            Now I need to create some thread for update all continuously or use some android thread. I am not and expert, but I use iTween library for Unity3D several times, and I know it is not the same, but it is possible that your library in future versions give to the user the possibility that TweenManager creates this special thread for android or java applications transparently (similar to iTween).

            By on the other hand, I think that wiki needs some update (GettingStarted part) because this kind of things are not explained or have some errors (long types, don’t start with 0 and set methods in Particle class are not implemented). I am not an expert, but I had some problems.

            Thank you very much for your help; we are in touch.

            • I updated the wiki, thx for letting me know :)

              About the update thread: actually, the engine is mostly used in games, and every game already has an infinite update loop (called the “game loop”). So tween manager update only requires to put the update call in the loop.

              For android or desktop java applications, you need to create this loop yourself. I can’t really create it for you, since you would have a lot of synchronization issues. You need a total control over it to avoid concurrent access to your animated objects, and therefore need to create it yourself. iTween relies on the Unity engine, which features a game loop, so the update process is trivial. The Universal Tween Engine does not target any specific framework, so you need to synchronize the updates yourself. It’s trivial when you have access to a game loop, but requires a dedicated thread if that’s not the case.

            • Bagus Pak saya mendukung ide Bapak itu, agar banyak yang mau invstasi di negara kita dan mengurangi kemiskinan, serta peraungggnan. Bapak layak jadi Presiden RI tahun 2014.

            • It’s posts like this that make surfing so much pleasure

            • Ken, perhaps we can figure out (hint, Cindy) how to make this beautiful flower out of clay so that we can have it around us and my livestock and it will cause no harm. They are pretty but I never fail to remember that lady when I see them and know that I cannot grow them here. Some things leave an impression and knowing that they cause harm to my animals does not allow me to plant them.

            • Bonne remarque mais…l’important n’est peut-être pas de savoir s’ils écrivaient… mais ce que se racontaient les classes aisées à cette époque.L’anecdote -qui courait vraiment dans les dîners en ville fin 1908 et début 1909 – en dit plus long sur la mentalité et les craintes des milieux bourgeois ou aristocrates de ce début de XXème siècle que sur les gens de maison eux-mêmes.l’auteur

            • Wonderful story, reckoned we could combine a handful of unrelated data, nonetheless actually really worth taking a search, whoa did one learn about Mid East has got extra problerms as well

            • Patricia T comentou em 27 de maio de 2011 às 12:18. Julia! Sou sua fã e adoro o Petiscos. Uma dúvida que eu tenho: porque fazer antes o make e depois o cabelo? Há um motivo? Um dia desses estava me arrumando para um evento importante e fiquei na dúvida se há um motivo para você seguir essa ordem. Obrigada!

            • Alright alright alright that’s exactly what I needed!

            • Just read your piece and loved it. Hope you and your son have shared more laughs and memories, since. And thank you also, for sharing the submission information online (very generous of you to do so).

  • I am working on an android application and a newbie to animations. I am not sure this question is relevant for you .Can i use this tween engine in android applications? . I have checked out the link http://stackoverflow.com/questions/5437936/android-tween-animation-of-a-bitmap and when i trying to implements Tweenable it shows error. I am using Latest version (6.3.2) library. Also do you have any sample code for android applications ?.


    • Don’t know if you were the OP of this stackoverflow question, but your answer is there :)

      Oh and by the way, the Tweenable interface is no more present since version 6. it has been replaced by a much more flexible TweenAccessor interface. See the Get Started page to know how to implement it.

      I don’t have a sample code for using it on a real Android UI since I only use it in Android games, but the answer I made in stackoverflow should point you in the right direction.

  • good engine

    hi iam newbie . i want to make a timeline for splash
    how can i change the screen when i finish the time line ?

    sorry for noob question . i just one to learn .
    thank you

  • please game a good tutorial … Thank you Very mutch

  • Hey Aurelien! Really cool library. You rocks!!!
    I’m learning about this amazing library

  • Hey Aurelien. Please im having abit of a problem. Is it possible to add a an SLPanel to a panel? I have been trying to add one and it just doesnt show up.. But when i place it on just a frame, it shows up.

    • It should be possible since it’s a JPanel behind the scenes. I can’t remember if I already tried that.

  • good library!!
    i am going to make an android application using animation for end task in college. May I use some codes from your application? If it’s yes, is there any requirement that I have to do?
    Need your response quickly. Thank you very much.

  • I am often browsing on the internet for content which could benefit me. Thx!

  • Having problems on Android getting a fade operation to work. I’m using libgdx 1.1.0
    I’m using TweenEngine-6.3.3. Basically, what is happening is the values returned through SpriteAccessor newValue[0] is constant and doesn’t change.

    Splash page code
    public class Splash implements Screen {

    private Sprite splashImage;
    private SpriteBatch batch;
    private TweenManager tweenManager;

    public void render(float delta) {

    // Start the TweenManager and link it to the running game delta

    // Tell LIBGdx to start the batch and draw the object(s) and then end the batch.

    public void resize(int width, int height) {


    public void show() {
    batch = new SpriteBatch();
    tweenManager = new TweenManager();
    Tween.registerAccessor(Sprite.class, new SpriteAccessor());
    Texture splashTexture = new Texture(“images/libgdx.png”);
    splashImage = new Sprite(splashTexture);
    splashImage.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    // Tells Tween to use the splashImage and adjust the ALPHA (Opaque) values
    // from 0 to 1 and then from 1 to 0 following a two second delay.
    Tween.set(splashImage, SpriteAccessor.ALPHA).target(0).start(tweenManager);
    Tween.to(splashImage, SpriteAccessor.ALPHA, 1).ease(Cubic.INOUT).target(1).repeatYoyo(1, 1).setCallback(new TweenCallback() {
    public void onEvent(int type, BaseTween source) {
    ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu());

    public void hide() {


    public void pause() {


    public void resume() {


    public void dispose() {


    public class SpriteAccessor implements TweenAccessor {
    public static final String TAG = SpriteAccessor.class.getName();

    public static final int ALPHA = 0;

    * This method is required by TweenAccessor. It is responsible for getting
    * color values from the target Sprite In this case we are returning the
    * opacity color a (r,g,b,a).
    * Returns int indicating the number of returnValues we are returning, or -1
    * if the default condition prevails and the assertion is fired.
    public int getValues(Sprite target, int tweenType, float[] returnValues) {
    int retVal = -1;
    switch(tweenType) {
    case ALPHA:
    Gdx.app.debug(TAG, “returnValues[0] = ” + returnValues[0]);
    returnValues[0] = target.getColor().a;
    retVal = 1;
    assert false;
    retVal = -1;
    return retVal;

    * This method is required by TweenAccessor. It will set the color values
    * in the target Sprite. (r,g,b,a).
    public void setValues(Sprite target, int tweenType, float[] newValues) {
    switch(tweenType) {
    case ALPHA:
    Gdx.app.debug(TAG, “newValues[0] = ” + newValues[0]);
    target.setColor(target.getColor().r, target.getColor().g, target.getColor().b, newValues[0]);
    assert false;


    com.wws.kscepter.tween.SpriteAccessor: returnValues[0] = 0.0
    com.wws.kscepter.tween.SpriteAccessor: returnValues[0] = 0.0
    com.wws.kscepter.tween.SpriteAccessor: returnValues[0] = 0.0
    com.wws.kscepter.tween.SpriteAccessor: newValues[0] = 0.0
    com.wws.kscepter.tween.SpriteAccessor: returnValues[0] = 0.0
    com.wws.kscepter.tween.SpriteAccessor: newValues[0] = 0.99607843
    com.wws.kscepter.tween.SpriteAccessor: newValues[0] = 0.99607843
    com.wws.kscepter.tween.SpriteAccessor: newValues[0] = 0.99607843
    com.wws.kscepter.tween.SpriteAccessor: newValues[0] = 0.99607843
    com.wws.kscepter.tween.SpriteAccessor: newValues[0] = 0.99607843
    com.wws.kscepter.tween.SpriteAccessor: newValues[0] = 0.99607843
    com.wws.kscepter.tween.SpriteAccessor: newValues[0] = 0.99607843
    com.wws.kscepter.tween.SpriteAccessor: newValues[0] = 0.99607843

  • http://www.tuneledrenazowe.pl/konstrukcja-elektrycznych-wozkow-widlowych
    Buying a used or new vehicle can be a hard approach unless you know what you will be doing. By teaching yourself about auto purchasing prior to visit the dealership, you could make stuff much easier for yourself. The following tips can help the next store shopping getaway become more satisfying.

    Constantly take a mechanic together when searching for a fresh vehicle. Automobile merchants are well known for promoting lemons and you do not wish to be their after that victim. Provided you can not obtain a auto mechanic to look at vehicles along with you, a minimum of make sure that you have him take a look at ultimate decision before you purchase it.

    Know your limitations. Before you begin purchasing for your next auto or truck, determine what you can manage to pay out, and stay with it. Don’t overlook to add interest in your estimations. You will definitely pay out around 20 % as a payment in advance at the same time, so be ready.

    Before visiting a car dealership, know what kind of car you would like. Analysis each one of you alternatives ahead of shopping in order to decide what works for your financial allowance and family members needs. Shop around to find out exactly how much you should pay for any probable auto.

    Before you sign any commitment make time to go through every single range, for example the small print. If you have anything listed that you simply do not recognize, usually do not signal before you get an answer that you just fully grasp. Unsavory salesmen may use an agreement to put several fees that were not discussed.

    In the event you maintain the previous assistance at heart the very next time that you just go shopping for a automobile, you will certainly be prone to get a full package. Investing in a car does not have to become a headaches. Use the information with this write-up and you will obtain the auto you would like at a very good selling price.

  • RE:About the Tween Engine demo | Aurelien Ribon’s Dev Blog Валок Джон дир Дюртюли

  • hi!,I really like your writing very a lot! proportion we communicate more approximately your post on AOL? I require an expert on this house to resolve my problem. May be that is you! Having a look forward to look you.

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>