Android Animation finishing

Source: Internet
Author: User

Mark a moment:

Animations can be implemented via XML or Android code.

Animation animation effects can be implemented in two ways, tweened animation (gradient animation) and frame by frame animation (picture conversion animation).

There are 4 types of animation available on Android:

tweened Animation has the following two types of gradient animations:

1.alpha Gradient Transparency Animation effect

2.scale Gradient size Stretch animation effect

Frame by Frame animation screen conversion animations are available in the following two categories:

1.translate picture Conversion position Move animation effect

2.rotate Picture Transfer rotation animation effect

The reference code is as follows:

1. Transparency Animation

 <!-- ?xml version= "1.0" encoding= " Utf-8 "?  -->  <  set  xmlns:android  = "Http://schemas.android.com/apk/res/android"       >  <!--     Transparency controls animation effect Alpha Float value: The Fromalpha property is transparent 0.0 for the start of the animation, which means full transparency Toalpha property to the end of the animation when the transparency 1.0 represents a full opacity above the value of the float data type between 0.0-1.0 numeric Long value: The Duration property is the animation duration in milliseconds Unit  -->  </ alpha  ></ set  >  

2. Zoom in on animations

<!--? xml version= "1.0" encoding= "Utf-8"? -<Setxmlns:android= "Http://schemas.android.com/apk/res/android">   < ScaleAndroid:interpolator= "@android: Anim/accelerate_decelerate_interpolator"Android:fromxscale= "0.0"Android:toxscale= "1.4"Android:fromyscale= "0.0"Android:toyscale= "1.4"Android:pivotx= "50%"Android:pivoty= "50%"Android:fillafter= "false"android:duration= "The "></ Scale></Set><!-- -

3. Displacement animation

<!--? xml version= "1.0" encoding= "Utf-8"? -<Setxmlns:android= "Http://schemas.android.com/apk/res/android">     <TranslateAndroid:fromxdelta= "+"Android:toxdelta= " -80"Android:fromydelta= "+"Android:toydelta= "+"android:duration= "$"><!--Translate position transfer animation effect integer value: The Fromxdelta property is the position on the x-coordinate at the start of the animation Toxdelta property is the position on the x-coordinate at the end of the animation  The Fromydelta property is the position of the y-coordinate at the start of the animation Toydelta property is the position of the y-coordinate at the end of the animation note: no Fromxtype specified   Toxtype Fromytype toytype time, the default is to use their own relative reference Long value: Duration property is the animation duration In milliseconds -</Translate></Set>

4. Rotate the animation

<!--? xml version= "1.0" encoding= "Utf-8"? -<Setxmlns:android= "Http://schemas.android.com/apk/res/android">    <RotateAndroid:interpolator= "@android: Anim/accelerate_decelerate_interpolator"android:fromdegrees= "0"android:todegrees= "+350"Android:pivotx= "50%"Android:pivoty= "50%"android:duration= " the">  <!-- rotate Rotation animation effect properties: interpolator Specifies an animated insert during the experiment, use the resources in Android.res.anim to send Existing three kinds of animation inserts: Accelerate_decelerate_interpolator acceleration-deceleration animation Insert Accelerate_interpol                                   Ator Acceleration-Animation insert Decelerate_interpolator deceleration-Animation insert other animation effects that belong to a specific Floating-point value: The Fromdegrees property is the angle of the object at the start of the animation Todegrees property is at the end of the animation when the angle of the object rotates can be greater than 360 Degree Description: When the angle is negative--indicates counterclockwise rotation when the angle is positive--Indicates a clockwise rotation (negative f                      Rom--to positive: Clockwise rotation) (negative from--to negative: counterclockwise) (positive from--to positive: clockwise rotation)                             (Positive from--to negative number: counterclockwise rotation) The Pivotx property is the start position of the animation relative to the object's x-coordinate Pivoty property is the beginning of the animation relative to the object's y-coordinate Note: The above two attribute values from the 0%-100% value 50% is the object's X or y-direction coordinates on the midpoint position Long value: Duration property The duration of the animation is in milliseconds  -</Rotate></Set>

XML files are generally placed in Res/anim/**.xml

Specific usage go to other articles

<!-- properties of the root node: Name Property Note Android:shareinterpolator If you share the plug-in share, four child nodes use a single plug-in Android:interpolator to specify an animated insert using system resources for Android: Fillenabled when set to True, Fillafter and fill, Befroe will be true, ignoring Fillbefore and fillafter two properties Android:fillafter Whether the animation conversion is applied at the end of the animation Booleanandroid:fillbefore whether the animation conversion was applied before the animation started Booleanandroid:repeatmode repeat mode "restart" or "reverse" Android:repeatcount repetition integer,0 Mark does not repeat android:duration animation duration integer, milliseconds android:startoffset animation interval longandroid: Zadjustment defines the transform of the animation z order [normal] or [top] or  [bottom]android:detachwallpaper--

Android Animation finishing

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.