Valueanimation of Android Properties animation

Source: Internet
Author: User

Valueanimation is the parent class of Objectanimation class, after the introduction of the previous days, I believe that we have a certain understanding of objectanimation, today for everyone to introduce the last valueanimation, Valueanimation Google provides better process control, now with a class of small animation for everyone to briefly introduce:

The layout file of the application is very simple, and there is only one button that will not be mentioned. The following highlights the specific implementation:

 Public voidinit () {button=(Button) Findviewbyid (R.id.fourbutton); Button.setonclicklistener (NewMybuttonlistener ()); }     Public classMybuttonlistenerImplementsview.onclicklistener{@Override Public voidOnClick (view view) {FinalValueanimator animator = valueanimator.ofint (1, 100); Animator.setduration (5000); Animator.setinterpolator (NewLinearinterpolator ());//Linear effect ChangeAnimator.addupdatelistener (NewValueanimator.animatorupdatelistener () {@Override Public voidonanimationupdate (Valueanimator valueanimator) {integer integer=(Integer) animator.getanimatedvalue (); Button.settext ("" +integer);            }            });        Animator.start (); }    }

The above is all the code for the small application, with the emphasis on the implementation of the Addupdatelistener () method, by rewriting the onanimationupdate of the Valueanimator.animatorupdatelistener () ( Valueanimator Valueanimator) method to control the entire implementation process of the animation.

Here about the properties of Android animation implementation of the introduction is complete, and now to summarize.

1. Common Properties:

Translationx/translationy: Horizontal | Vertical offset

Rotation/rotationx/rotationy:3d Flip

Scalex/scaley:x Shafts | Y-Axis Scaling

X/y: The specific point to move to

Alpha: Transparency

These five properties of the property animation, similar to the four properties of the previous value animation, are more efficient and better performing the property animation framework.

2. Common methods and classes:

Valueanimation, Objectanimation class: For these two classes, I believe you must not be unfamiliar with, more features please check Google API

Animationupdatelistener, Animationlisteneradapter: Listener events for animating properties

Popertyvaluesholder: Control the display effect, order and process control of animation collection

Animationset, Typeevaluators: Value Calculator and Difference Calculator

Interpolator: The change pattern of animation display

3. Interpolator Properties:

Accelerateinterpolator: Accelerating continuously

Decelerateinterpolator: constantly slowing down

Anticipateinterpolator: Front Convex

Overshootinterpolator: Tail Warp

Linearinterpolator: Linear change

Bounceinterpolator: Free Falling

The above is the Interpolator Difference 6 properties, you can experiment in the project, so that you can better understand and use.

To today, the summary of Android properties animation for everyone to complete the dedication, Welcome to Exchange Learning ([email protected]).

Valueanimation of Android Properties animation

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.