Android animation category and difference, android animation category

Source: Internet
Author: User

Android animation category and difference, android animation category


Android contains three types of animations: View Animation, Drawable Animation, and Property Animation (newly introduced in Android3.0 ).

View Animation:

Based on the gradient animation of the View, she only changed the rendering effect of the View, but the actual attribute value has not changed. For example, when an animation moves a button, the actual position of the button is not changed. To define an Animation in code, you can refer to the AnimationSet class and the Animation subclass. If you use XML, you can define an XML file in the res/anim/folder.

Drawable Animation:

Load a series of Drawable resources to create an animation. This traditional animation creates different image sequences and plays them in sequence, just like a film. Define animation frames in code and use the AnimationDrawable class. XML files can more easily form animation frames in the res/drawable folder, use <animation-list> <item> to define different frames. The animation interval can only be set.

Property Animation:

In addition to the traditional View Object, the animation Object can also be an Object. After the animation, the attribute value of the Object is actually changed. Property animation can achieve View animation by changing the actual properties of the View object. When the View attribute changes, the View can automatically call invalidate () to refresh the page.

New Property of View when implementing Property animation:

  • TranslationX and translationY: The change value of the upper left Coordinate
  • Rotation, rotationX, and rotationY
  • ScaleX, scaleY: horizontal and vertical scaling ratio, such as: 1.2f, 0.8f
  • PivotX, pivotY: the center of the View by default. If you want to rotate or scale a View in the center of the top left coordinate of the View, set the value to 0.
  • X, y:
  • Alpha: transparency. The default value is 1, 0, indicating full transparency, that is, invisible.

Instance: ObjectAnimator. ofFloat (myView, "rotation", 0f, 270f );

These attributes correspond to the View attributes in the Layout file. The difference is that they correspond to android: transformPivotX and android: transformPivotX. In addition, scaleX and scaleY: zooming are based on the original size, for example, if you want to reduce the size by two times, that is, to restore to its own size, if you use ViewPropertyAnimator, the code should be as follows:

  • MyView. animate (). scaleX (2.0f). scaleY (2.0f) // doubles
  • MyView. animate (). scaleX (1.0f). scaleY (1.0f) // restore

From Android 3.1, the XML file definition of Property animation is located in res/animator/instead of res/anim /). The XML labels in the Property animation class are as follows:

  • ValueAnimator-<animator>
  • ObjectAnimator-<objectAnimator>
  • AnimatorSet-<set>


What are the features of animations in android?

There are four basic animations in the android. view. animation package: transparent, scalable, mobile, and rotated. Animation type Android animation consists of four types: alpha gradient transparency in XML animation effect scale gradient size scaling animation effect translate screen conversion position mobile animation effect rotate screen transfer rotation animation effect AlphaAnimation gradient in JavaCode transparency Animation effect ScaleAnimation gradient size scaling Animation effect TranslateAnimation screen conversion position movement Animation effect RotateAnimation screen transfer rotation Animation effect Android Animation Mode there are two main Animation modes: one is JavaCodealphaAlphaAnimationscaleScaleAnimation in tweened animation (gradient animation) XML, and the other is JavaCodetranslateTranslateAnimationrotateRotateAnimat in frame by frame (image conversion animation) XML. IonTween animation, which allows view components to move, zoom in, zoom out, and change the transparency. Frame Animation, a traditional animation method, is implemented through sequential playback of arranged images, similar movies.

What are the features of animations in android?

There are four basic animations in the android. view. animation package: transparent, scalable, mobile, and rotated. Animation type
Android animation consists of four types
XML alpha gradient transparency animation effect scale gradient size scaling animation effect translate screen conversion position movement animation effect rotate screen transfer rotation animation effect JavaCode AlphaAnimation gradient transparency animation effect ScaleAnimation gradient size scaling animation effect TranslateAnimation picture conversion position movement animation effect RotateAnimation picture transfer rotating animation effect Android Animation Mode
Animation mainly has two Animation modes:
One is JavaCodealphaAlphaAnimationscaleScaleAnimation in the tweened animation (gradient animation) XML, and the other is the animation in the frame by frame (screen conversion animation) XML, this implementation method allows view components to move, zoom in, zoom out, and change transparency. Frame Animation, a traditional animation method, is implemented by playing the picture in sequence, similar to a movie.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.