Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Basic Android Animation

648 views

Published on

As presented on Free Android Workshop in Leapfrog Academy on Basic Animations in Android

Published in: Software
  • Login to see the comments

Basic Android Animation

  1. 1. Basic View Animation in Android By Shilu Shrestha
  2. 2. Pre-requisites • Installed well functioning Android Studio • Basic knowledge of programming in Android is a plus
  3. 3. animation anɪˈmeɪʃ(ə)n/ noun the state of being full of life or vigour; liveliness.
  4. 4. Why do we need Animation in Android?
  5. 5. • Notify when screen changes its state; Such as when content load is complete. • Communicate quickly and concisely with your user. • Adds a polished finished look to your app.
  6. 6. Animation in Android
  7. 7. Property Animation
  8. 8. • A property animation changes a property's (a field in an object) value over a specified length of time. • Property animation allows you to animate almost anything.
  9. 9. View Animation • Tween Animation • Frame Animation
  10. 10. Tween Animation
  11. 11. • Perform a series of simple transformations (position, size, rotation, and transparency) on the contents of a View object. • Calculates the animation with information such as the start point, end point, size, rotation, and other common aspects of an animation. • Can be done using XML or Programmatically
  12. 12. Animation using XML File • Like all xml there should be one root file • File location: • res/anim • The elements performing xml animations are • <alpha> • <scale> • <rotate> • <translate> • Animation elements maybe grouped using <set> element.
  13. 13. • <alpha> : fade in / fade out • <android:fromAlpha> • <android:toAlpha> • “1.0" : opaque • “0.0” : transparent
  14. 14. • <scale> : resize image • <android:fromXScale> • <android:toXScale> • <android:fromYScale> • <android:toYScale> • <android:pivotX> • <android:pivotY>
  15. 15. • <rotate> : rotation animation • <android:fromDegrees> • <android:toDegrees> • <android:pivotX> • <android:pivotY>
  16. 16. • <translate> : a vertical or horizontal translation • <android:fromXDelta> • <android:toXDelta> • <android:fromYDelta> • <android:toYDelta>
  17. 17. Demo
  18. 18. Animation Listener • Animation listener receives notifications from animation. • onAnimationStart (Animation animation) • onAnimationRepeat (Animation animation) • onAnimationEnd (Animation animation)
  19. 19. Animation using Java Code
  20. 20. Demo
  21. 21. Frame Animation
  22. 22. • An animation defined in XML which shows the sequence of images in order. • File location: • res/drawable/<filename>.xml • Elements • <animation-list> : root element contains list of <item> • <android:oneshot> : attribute to loop animation
  23. 23. Demo
  24. 24. Some Ideas
  25. 25. • Final Repo: https://github.com/shilu-stha/Basic- Animations
  26. 26. Thank-you

×