Android--objectanimator Animation (i)

Source: Internet
Author: User

Paste directly into the central usage

Package Com.example.test;import Com.example.test.views.circleview;import Android.animation.animator;import Android.animation.animatorset;import Android.animation.keyframe;import Android.animation.objectanimator;import Android.animation.propertyvaluesholder;import Android.annotation.suppresslint;import Android.app.Activity;import Android.os.bundle;import Android.view.view;public class Circleviewactivity extends Activity {private com.example.t        Est.views.CircleView CV;        @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);        Setcontentview (R.layout.activity_circleview);    Move ();        } public void Move () {CV = (Circleview) Findviewbyid (R.ID.CV); Objectanimator.offloat (CV, "Translationx", 0f,200f). Setduration (+). Start ();//Objectanimator.offloat (c V, "Translationy", 0f,200f). Setduration (+). Start ();//Objectanimator.offloat (CV, "rotation", 0f,360f). Setduratio N (1000). Start ();//Propertyvaluesholder Holder = propertyvaluesholder.offloat ("Rotation", 0f,360f);//PropertyValue Sholder Holder1 = propertyvaluesholder.offloat ("Translationy", 0f,200f);//Propertyvaluesholder Holder2 = Propertyv Aluesholder.offloat ("Translationx", 0f,200f);//Objectanimator.ofpropertyvaluesholder (CV, Holder,holder1,holder2)        . Setduration (+). Start (); Objectanimator A1 =objectanimator.offloat (CV, "Translationx", 0f,200f);//Objectanimator A2 =objectanimat        Or.offloat (CV, "Translationy", 0f,200f);//Objectanimator A3 =objectanimator.offloat (CV, "rotation", 0f,360f);// Animatorset set = new Animatorset ();////set.playsequentially (A1,A2,A3);////Set.playtogether (A1,A2,A3)  ; Display methods cannot be used together.  Set.play (A2). before (A1);        Sequential control//Set.play (A2). before (A3);//set.setduration (+);//Set.start ();        Keyframe kf0 = Keyframe.offloat (0f, 0f); Keyframe Kf1 = Keyframe.offloat (.5f, 360f);        Keyframe Kf2 = keyframe.offloat (. 2f, 720f);        Propertyvaluesholder pvhrotation = propertyvaluesholder.ofkeyframe ("Rotation", kf0, Kf1, KF2);        Objectanimator Rotationanim = Objectanimator.ofpropertyvaluesholder (CV, pvhrotation);        Rotationanim.setduration (5000);            Rotationanim.start ();//Objectanimator.ofargb (CV, Accessibility_service, 244). Setduration (+). Start (); }}

Android--objectanimator Animation (i)

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.