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