Android animation effects translate, scale, alpha, rotate

Source: Internet
Author: User

Type of animation
Android animation is made up of four different types

in XML

Alpha Gradient Transparency Animation effect
Scale Gradient Dimension Stretch animation effect
Translate Move animation effect on picture transition position
Rotate Picture Transfer rotation animation effect



in javacode

alphaanimati On gradient transparency animation effect
scaleanimation
translateanimation
rotateanimation Picture transfer rotation animation effect

Android Animation mode
Animation There are two main modes of animation:
One is tweened animation ( gradient animation )

in XML Javacode
Alpha Alphaanimation
Scale Scaleanimation



One is frame by frame ( picture conversion animation )

in XML Javacode
Translate Translateanimation
Rotate Rotateanimation

Android Animation parsing

Alpha XML fade Out effect

<?xml version="1.0"encoding="Utf-8"?> <SetXmlns:android="http://schemas.android.com/apk/res/android"> <Alpha Android:fromalpha="1.0"Android:toalpha="0.0"android:duration=" -"/> </Set> <!--Fromalpha: Start transparency Toalpha: End Transparency Duration: duration of animation-

Alpha XML fade-in effect

<?xml version="1.0"encoding="Utf-8"?> <SetXmlns:android="http://schemas.android.com/apk/res/android"> <Alpha Android:fromalpha="0.0"Android:toalpha="1.0"android:duration=" -"/> </Set> <!--Fromalpha: Start transparency Toalpha: End Transparency Duration: duration of animation-

Rotate.xml Rotation Effect:

<?xmlversion="1.0"encoding="Utf-8"?> <setxmlns:android="http://schemas.android.com/apk/res/android"> <Rotate Android:interpolator="@android: Anim/accelerate_decelerate_interpolator"android:fromdegrees=" -"android:todegrees="-360"Android:pivotx="10%"Android:pivoty="100%"android:duration="10000"/> </Set> <!--Fromdegrees the angle at which the animation starts todegrees the rotation angle of the object at the end of the animation, which means that the clockwise Pivotx property is the start position of the animation relative to the object's x-coordinate Pivoty property is the start position of the animation relative to the object's y-coordinate -

Scale.xml Zoom Effect:

<?xml version="1.0"encoding="Utf-8"?> <SetXmlns:android="http://schemas.android.com/apk/res/android"> <Scale Android:interpolator="@android: Anim/decelerate_interpolator"Android:fromxscale="0.0"Android:toxscale="1.5"Android:fromyscale="0.0"Android:toyscale="1.5"Android:pivotx="50%"Android:pivoty="50%"Android:startoffset="0"android:duration="10000"Android:repeatcount="1"Android:repeatmode="Reverse"/> </Set> <!--x, y coordinates at the beginning of the Fromxdelta,fromydelta, and the coordinates in the lower right corner of the screen are ×: theY:480Toxdelta, Toydelta x, y coordinates at the end of the animation-<!--interpolator Specifies that the animation insert is common with an acceleration reducer accelerate_decelerate_interpolator speed up the insertion device accelerate_interpolator, decelerate the plug    Decelerate_interpolator. Fromxscale,fromyscale, the scale of X, y before the animation starts,0.0 is not displayed,1. 0 for normal size Toxscale,toyscale, the multiple of the final zoom of the animation,1. 0 is normal size, greater than 1.0 magnification Pivotx, pivoty animation start position, relative to the screen percentage, two are%indicates that the animation starts from the middle of the screen startoffset, the interval between the animation execution, if only once, the execution will pause the time, the unit millisecond duration, an animation effect consumes time, in milliseconds, the smaller the value of animation faster Repeatcoun T, animation repeats the count, the animation will execute the value+1 times Repeatmode, the animation repeats the pattern, the reverse is reversed, and when the first even executes, the animation will be in the opposite direction. Restart for re-execution, direction unchanged-

Translate.xml Move Effect:

<?xmlversion="1.0"encoding="Utf-8"?> <setxmlns:android="http://schemas.android.com/apk/res/android"> <Translate Android:fromxdelta=" the"Android:toxdelta="0"Android:fromydelta="480"Android:toydelta="0"android:duration="10000"/> </Set> <!--x, y coordinates at the beginning of the Fromxdelta,fromydelta, and the coordinates in the lower right corner of the screen are ×: theY:480Toxdelta, Toydelta x, y coordinates at the end of the animation-

Android animation effects translate, scale, alpha, rotate

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.