A (175)

(Tuis.) #1

396 CHAPTER 10: Android Animation: Making Your UI Designs Move


Frame animation will give you more control outside of the Android OS, because you can use
production software, including 3D, digital imaging, digital video, digital illustration, special effects,
particle systems, fluid dynamics, morphing, digital painting, and the like to manipulate all of your
pixels into exactly the animation effect that you’re looking to achieve.


Since Android does not yet include all of these advanced multimedia production tools, using frame
animation will allow you to leverage powerful production tools, some of which we will be using within
this book, outside of the Android development environment, and then bring the results into your
Android app using the image assets defined as frames within in the AnimationDrawable object.


Procedural animation tends to be more processing-intensive, because there is numeric value
interpolation, as well as the application of interpolator motion curves to those resulting interim data
values. Additionally, if sets and sub-sets are utilized to create a complex animation structure, there
can be a great deal more data processing involved, as well as the memory space which would be
required to hold the plethora of settings, ranges, pivots, interpolation values, and similar animation
processing data that will be needed by the Animation subclasses.


Procedural animation gives you more control inside of Android. This is because you are doing
everything that controls your animation using Java code and XML markup, and your animation data
and can made to be interactive within your Java programming logic. This is because Java code
and data (and even your UI elements) can be crafted to interface with the procedural animation in
real-time, allowing it to be made interactive, whereas frame animation, at least by itself, is not as
interactive. Frame animation by itself is a more linear medium, like digital video, where frames are
played sequentially to achieve the motion result.


Since you can apply procedural animation to just about any View object in Android, including your
text, UI widgets, images, video, and frame animation, if you set things up correctly, such as using
image compositing techniques to their best results, you can achieve some impressive interactivity
by using frame animation in conjunction with procedural animation, as you have seen during
this chapter.


If you are combining frame with procedural animation, as we did during this chapter, you will have
a load on both processor and memory resources, so you must try and optimize what you are
doing, so that you don’t use up too much of the system resources needed to run the rest of your
application code and UI. This is why we were concerned with our data footprint optimization in
Chapter 9, and why we’re learning about the same type of optimization principles here.


The Animator Class: Parameter Animation


There is another animation class in Android which I did not cover in this chapter, as it is not a new
media asset, but rather a way to animate parameter changes in any Android class which uses XML
to implement its objects. You can use Android’s Animator class as a shortcut to animating object
properties inside of Android that would usually be animated (changed over time) using Java iteration
loops. To research this on your own, you can visit the following Android Developer website if this
area is of interest for your app:


http://developer.android.com/reference/android/animation/Animator.html

Free download pdf