开发者

Is there a TweenMax equivalent in Java

I'm still relatively new to Java and Android development, so I'm s开发者_开发知识库till unfamiliar with the multitudes of libraries available for use, particularly for animation. Where I'm from (the Flash world), we have access to several 3rd-party tweening engines that make life very easy for us when we want to programmatically move things around the stage without relying on the (vastly inferior) built-in Adobe tween APIs. One of the most popular is Greensock's TweenMax

Looking at the way Android handles tweening natively, it appears to be very cumbersome compared to what I'm used to. I'm curious if there's a TweenMax-equivalent library out there for Android that makes animation sequencing equally easy to write in-code, with the benefits of smart intellisense, rather than having to write them all out in an external animation.xml file in the res folder.


Sorry to reply so lately to this thread, but there is a more framework-independent answer to your question: the java Universal Tween Engine.

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

Is there a TweenMax equivalent in Java

This library started as a way to mimic TweenMax/Lite functionality in any java project, and ended as a complete, independent, tweening engine. It is optimized for Android (no dynamic allocation), but can be used in virtually every java project, being a Swing UI or an OpenGL game...

You shouldn't be lost if you come from TweenMax world, since the base syntax is quite similar:

Tween.to(myObject, POSITION, 1000).target(20, 30).ease(Elastic.OUT).start(myManager);

Timelines are a bit different though, but are still easy to understand:

Timeline.createSequence()
    // First, set all objects to their initial positions
    .push(Tween.set(...))
    .push(Tween.set(...))
    .push(Tween.set(...))

    // Wait 1s
    .pushPause(1000)

    // Move the objects around, one after the other
    .push(Tween.to(...))
    .push(Tween.to(...))
    .push(Tween.to(...))

    // Then, move the objects around at the same time
    .beginParallel()
        .push(Tween.to(...))
        .push(Tween.to(...))
        .push(Tween.to(...))
    .end()

    // And repeat the whole sequence 2 times
    .repeatYoyo(2, 500)

    // Let's go!
    .start(myManager);

Hope that helps :)


You don't have to use XML files, you can use Animation, AnimationSet and the various Interpolator implementations. Android 3.0 however provides a much more powerful animation API.


Actually, I think I have found something close to what I was asking for. There's a port of Cocos2D for Android here : Cocos2D for android

It's not completely bug free (thinking mostly of the particle system here), but it offers a wide range of animation and display functions for the sorts of things you'd use Greensock for. It even comes with a Box2D port on top of it all.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜