Interpolator and Animationset of Android animations

Source: Internet
Author: User

Animationset can join animation and set Animationset to be valid for all animation to join.

[Java]View Plaincopy
  1. Animationset anim=New Animationset (true);
  2. Alphaanimation a=New Alphaanimation (1,0);
  3. Rotateanimation ra=New Rotateanimation (0, 720, animation.relative_to_self,0.5f, animation.relative_  To_self,0.5f);
  4. Anim.addanimation (a);
  5. Anim.addanimation (RA);
  6. Anim.setduration (3000);
  7. Anim.setstartoffset (1000);
  8. Iv.startanimation (ANIM);


Multiple animation can be defined in the XML file so that multiple animation can be run together

[HTML]View Plaincopy
  1. <? XML version= "1.0" encoding="Utf-8"?>
  2. <set xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:interpolator="@android: Anim/accelerate_interpolator"
  4. android:shareinterpolator="true"
  5. >
  6. <Alpha
  7. android:fromalpha="1.0"
  8. android:toalpha="0.0"
  9. android:startoffset="
  10. android:duration=" the"
  11. />
  12. <rotate
  13. android:fromdegrees="0"
  14. android:todegrees="The "
  15. android:pivotx="50%"
  16. android:pivoty="50%"
  17. android:duration=" the"
  18. />
  19. </Set>


Interpolator can define the speed of animation playback

Defining interpolator in an XML file

Android:interpolator= "@android: Anim/accelerate_interpolator"
Android:shareinterpolator= "true"

So all the animation share a interpolator.

Set the following code in code

Anim.setinterpolator (New Accelerateinterpolator ());

When you pass in new one animationset true, all animation share the interpolator.

Interpolator and Animationset of Android animations

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.