Skip to content

Instantly share code, notes, and snippets.

@mfurtak
Created May 17, 2013 13:27
Show Gist options
  • Save mfurtak/5599026 to your computer and use it in GitHub Desktop.
Save mfurtak/5599026 to your computer and use it in GitHub Desktop.
Notes from the May 16 talk, "A Moving Experience" at Google I/O 2013

A Moving Experience

Elements of Good Animations

  • Keep them short, but appropriate to the action that is happening
    • (defaults to 300ms on Android for property animator)
  • Keep them smooth
    • Don't run layout during animation! Do it first.
    • Use the right timing curve
  • Keep them natural
    • Don't be whizzy for the sake of it, keep it organic to the app
  • Keep them purposeful
    • No burning windows just for the sake of it
    • Make the animation exist for a reason

List Animation

  • View.setHasTransientState(true), makes the list view leave those views alone while you animate them. If you don't - they might get recycled or whatever!
    • ViewPropertyAnimator sets this automatically for you

Activity Animations

  • overridePendingTransition(0, 0); Tells the OS not to do any activity animation - we'll take care of it!
    • We also call it when we finish() so that we customize the exit animation

Cartoon Animation Techniques

  • PropertyValuesHolder, ObjectAnimator - they're your friends!
  • OvershootInterpolator gives you a nice wobble/bounce at the end of the animation
  • AnimationSet for doing a series of animations in sequence
  • Curved motion feels more natural than straight-line motion

Quick tips

  • Avoid layout during the animation
  • ViewTreeObserver can be used to listen to global events in the view hierarchy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment