Professional Documents
Culture Documents
A Moving Experience
Better Animation in Android Applications
Romain Guy
Chet Haase
13
Why?
Connect the user to the application. Keep them plugged into whats happening. Help them understand what could be a confusing UI experience.
Why?
Engage
Connect the user to the application. Keep them plugged into whats happening. Help them understand what could be a confusing UI experience.
Why?
Engage Inform
Connect the user to the application. Keep them plugged into whats happening. Help them understand what could be a confusing UI experience.
Short
Dont make the user wait. Make them only long enough to get the point across. Example: window animations that start most of the way through.
Stuttery animations are worse than no animations at all. make sure you tune your graphics performance to make them feel smooth. do expensive operations (e.g., layout) before you start. Make the durations match the distance and complexity needed.
Smooth
Stuttery animations are worse than no animations at all. make sure you tune your graphics performance to make them feel smooth. do expensive operations (e.g., layout) before you start. Make the durations match the distance and complexity needed.
Animations should feel good and normal, not amazing and bizarre. Theyre there to help the user, not confound them. Most animations shouldnt event be noticeable to the user, theyre so well integrated into the experience.
Natural
6 Friday, May 17, 13
Animations should feel good and normal, not amazing and bizarre. Theyre there to help the user, not confound them. Most animations shouldnt event be noticeable to the user, theyre so well integrated into the experience.
Dont use them because theyre nifty - use them to accomplish things: transitioning the user, helping inform them of things they should know about, engaging their attention, reacting to input, ...
Arbitrary
Dont use them because theyre nifty - use them to accomplish things: transitioning the user, helping inform them of things they should know about, engaging their attention, reacting to input, ...
l u f e s o p r u P
Arbitrary
Dont use them because theyre nifty - use them to accomplish things: transitioning the user, helping inform them of things they should know about, engaging their attention, reacting to input, ...
Samples
Demos to help you understand how to accomplish common use cases in Android applications
List Animation
Demo: ListViewRemovalAnimations Animating the swipe and animating closing the gap.
10
Activity Animations
Demo: ActivityAnimations Going [way] beyond what window animations provide. Idea: launch the activity without window animations, then do whatever you want.
Intent subActivity = new Intent(...); subActivity.putExtra("package.propertyname1", val1). putExtra("package.propertyname2", val2); startActivity(subActivity); overridePendingTransitions(0, 0);
12 Friday, May 17, 13
styles.xml
<style name="Transparent"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@null</item> </style>
extract the data from the Bundle and animate into the new activity appropriately
Timing
Refers to both non-linear timing (ease in/out), to get more natural feel of animations, as well as appropriate timing of interactions. For example, a button press should be very quick; a slow animation would be horrible. Demo: SquashAndStretch (show squash&stretch *and* Timing)
Timing
Refers to both non-linear timing (ease in/out), to get more natural feel of animations, as well as appropriate timing of interactions. For example, a button press should be very quick; a slow animation would be horrible. Demo: SquashAndStretch (show squash&stretch *and* Timing)
Anticipation
The action *before* the animation helps the user understand what is going to happen. Examples: rearing back before running. In cartoons, this was important because the action was very quick; if the user didnt understand quickly what was happening, theyd get lost. Anticipation helps indicate the action.
Anticipation
The action *before* the animation helps the user understand what is going to happen. Examples: rearing back before running. In cartoons, this was important because the action was very quick; if the user didnt understand quickly what was happening, theyd get lost. Anticipation helps indicate the action.
In life, we dont just stop when we hit things. Gravity, momentum, and physical structure of objects makes us continue in the path of motion, and maybe bounce back. More organic, natural animations can use this technique, too. 2 Demos: LiveButton & Anticipation (anticipation: button reacting to press. follow through: button overshooting at end of animation)
In life, we dont just stop when we hit things. Gravity, momentum, and physical structure of objects makes us continue in the path of motion, and maybe bounce back. More organic, natural animations can use this technique, too. 2 Demos: LiveButton & Anticipation (anticipation: button reacting to press. follow through: button overshooting at end of animation)
Non-Linear Motion
Objects in our world dont travel in straight lines. The shortest path is a straight line, but the most realistic one is a curve. Demo: CurvedMotion
Non-Linear Motion
Objects in our world dont travel in straight lines. The shortest path is a straight line, but the most realistic one is a curve. Demo: CurvedMotion
Emphasizing a point, or having fun with it, by doing more of it. In cartoons, really big features, or a really major squash to get a rubbery feel. Again, you wanted the viewer to understand quickly things about the characters and the actions in the cartoons. Demo: ToonGame
Exagggggggggggggggggggeration
Emphasizing a point, or having fun with it, by doing more of it. In cartoons, really big features, or a really major squash to get a rubbery feel. Again, you wanted the viewer to understand quickly things about the characters and the actions in the cartoons. Demo: ToonGame
Exagggggggggggggggggggeration
De Too nG
mo !
am e
Emphasizing a point, or having fun with it, by doing more of it. In cartoons, really big features, or a really major squash to get a rubbery feel. Again, you wanted the viewer to understand quickly things about the characters and the actions in the cartoons. Demo: ToonGame
Tips
Avoid Layout
Layout is expensive. Avoid running it during each animation frame, especially for complex view hierarchies. Its okay to run it once at the beginning, to measure where things are going to be, but then animate using another approach (like translationX, translationY, as in ListViewRemovalAnimations).
ViewTreeObserver
OnPreDrawListener: Great technique to run layout, but then capture the pre/post values just prior to drawing and animate them from start to nish.
Layers
Performance tip: set a layer on complex views or layouts during animations on those objects.
More info
Friday, May 17, 13
The Illusion of Life Thomas and Johnston Chets Tips & Tricks graphics-geek.blogspot.com Romains Tips & Tricks www.curious-creature.org
More info
Friday, May 17, 13
google.com/+ChetHaase google.com/+RomainGuy
@chethaase @romainguy
Q&A
Friday, May 17, 13
Developers