Thursday, July 11, 2013

Android Animation Tutorial

We can animate all the views like Layouts, TextViews,ImageViews, Buttons etc. Animation makes the GUI  more interactive and enhance User Experience.

Android offers two kinds of animation:
Frame-by-Frame Animations are  Traditional cell-based animations in which a different Drawable
is displayed in each frame. Frame-by-frame animations are displayed within a View,
using its Canvas as a projection screen.
Tweened Animations Tweened animations are applied to Views, letting you define a series
of changes in position, size, rotation, and opacity that animate the View contents.


Note: Both animation types are restricted to the original bounds of the View they’re  applied to.   Rotations, translations, and scaling transformations that extend beyond
the original boundaries of the View will result in the contents being clipped.


 Tweened Animations

Tweened animations offer a simple way to provide depth, movement, or feedback to your users at a
minimal resource cost.
Using animations to apply a set of orientation, scale, position, and opacity changes is much less
resource-intensive than manually redrawing the Canvas to achieve similar effects, not to mention far
simpler to implement.

Tweened animations are commonly used to:
➤ Transition between Activities.
➤ Transition between layouts within an Activity.
➤ Transition between different content displayed within the same View.
➤ Provide user feedback such as:
➤ Indicating progress.
➤ ‘‘Shaking’’ an input box to indicate an incorrect or invalid data entry.
Creating Tweened Animations
Tweened animations are created using the Animation class. The following list explains the animation
types available.
➤ AlphaAnimation Lets you animate a change in the View’s transparency (opacity or alpha
blending).
➤ RotateAnimation Lets you spin the selected View canvas in the XY plane.
➤ ScaleAnimation Allows you to zoom in to or out from the selected View.
➤ TranslateAnimation Lets you move the selected View around the screen (although it will
only be drawn within its original bounds).

Android offers the AnimationSet class to group and configure animations to be run as a set. You can
define the start time and duration of each animation used within a set to control the timing and order
of the animation sequence.
It’s important to set the start offset and duration for each child animation, or they will all start and complete at the same time.

Animating Layouts and View Groups

A LayoutAnimation is used to animate View Groups, applying a single Animation (or Animation Set)
to each child View in a predetermined sequence.
Use a LayoutAnimationController to specify an Animation (or Animation Set) that’s applied to each
child View in a View Group. Each View it contains will have the same animation applied, but you can
use the Layout Animation Controller to specify the order and start time for each View.
Android includes two LayoutAnimationController classes.
LayoutAnimationController Lets you select the start offset of each View (in milliseconds)
and the order (forward, reverse, and random) to apply the animation to each child View.
GridLayoutAnimationController Is a derived class that lets you assign the animation
sequence of the child Views using grid row and column references.


Following are Examples of Animating diffrent types of Views

Android Animation Examples:


Animating  ImageViews




Layout Animations

13 comments:

  1. I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day!
    ​Speciaali

    ReplyDelete
  2. This post is really useful and helpful to know more about the things which you have shared. I appreciate you for such a great amount of information. I assure this would be beneficial for many people. Online Animation Courses Trivandrum

    ReplyDelete
  3. Certsout.com provides authentic IT Certification exams preparation material guaranteed to make you pass in the first attempt, this is the right platform where you can get exact 7392X exam questions answers.

    ReplyDelete
  4. Interesting post. I Have Been wondering about this issue, so thanks for posting. Pretty cool post.It 's really very nice and Useful post.Thanks Collective conscious

    ReplyDelete
  5. I like this post, enjoyed this one thanks for posting . top logo designers

    ReplyDelete
  6. Movie buffs fashion themselves to be quite the astute individuals, a beautiful combination of intelligence, taste, and an appreciation of all this artistic. It is quite the event when one movie aficionado finds themselves face-to-face with their match. As with any couple, finding things in common is a major key to having a great relationship, but for movie lovers, the innate power of cinema and appreciation for the celluloid arts makes for a highly combustible love.

    0123movie.net

    ReplyDelete
  7. I genuinely enjoy your website, but I’m having a problem: any time I load one of your post in Firefox, the center of the web page is screwed up — which is bizarre. May I send you a screenshot? In any event, keep up the superior work; I definitely like reading you. web design in new york

    ReplyDelete
  8. This is a correct weblog for anyone who wishes to be familiar with this topic. You are aware of a lot its almost tricky to argue together with you (not too I really would want…HaHa). You definitely put a brand new spin over a topic thats been written about for many years. Great stuff, just great! branding agencies in san francisco

    ReplyDelete
  9. They delivered a significant amount of quality code to support the development process satisfactorily. UX companies team was accessible and included capable talent that was accessible, facilitating an effective engagement. They were enthusiastic and communicative, which enabled successful collaboration.

    ReplyDelete
  10. This is an awesome article, thank you for sharing.
    Regards,Animation Studio in Hyderabad

    ReplyDelete
  11. Thanks for making the honest attempt to speak about this. I believe very robust approximately it and want to read more. If it’s OK, as you gain more in depth wisdom, would you thoughts adding extra articles similar to this one with additional information? It might be extremely useful and useful for me and my friends. design agencies sf

    ReplyDelete
  12. I think this is among the most vital info for me. And i am glad reading your article. But want to remark on some general things, The site style is great, the articles is really great : D. Good job, cheers ux agency san francisco

    ReplyDelete
  13. This is tough. I’m not pointing fingers at you though, personally I think that its those that aren’t motivated to change. tablet mockup

    ReplyDelete