I'm still relatively new to Java and Android development, so I'm still 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/
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With