Android Property Animation --- Property Animation (3)

Source: Internet
Author: User

API Overview

You can find the APIs of most property animation systems in the android. animation package. Because the view animation system has defined a lot of interpolation in the android. view. animation package, these interpolation can also be used in the property animation system. The following table describes the main components of the property animation system.

The Animator class provides the basic architecture for creating animations. This class is usually not used directly, because it only provides basic functions, so it must be extended to fully support animation values. The following table lists the sub-classes of Animator.

Table 1. Animators

Class
Description
 
ValueAnimator
The time series engine used to calculate and process animation attribute values. It has some core functions for calculating animation values, including the timing details of each animation, information about whether the animation is repeated, listening to receive update events, and setting and evaluating the custom type. There are two types of animation attributes: 1. Calculate the animation processing value; 2. Set these values to the object and attribute for animation processing. The ValueAnimator class does not execute the second type of attributes. Therefore, you must use the ValueAnimator object to listen for changes to the calculated value and modify the logic of the expected animation object. For more information, see use the ValueAnimator class for animation processing. Http://developer.android.com/guide/topics/graphics/prop-animation.html#value-animator)
 
ObjectAnimator
A subclass of the ValueAnimator class that allows animation of the target object and object attributes. This class updates the coordinates of attributes when calculating new animation values. The ObjectAnimator class is used most of the time because it makes it easier to process animation values. However, the ValueAnimator class is also used directly in some cases, because the ObjectAnimator class has more restrictions. For example, you need to specify the acessor Method for rendering on the target object.
 
AnimatorSet
It provides a mechanism to organize Animations together so that they can run in an interactive manner. You can set an animation to play together, play in sequence, or play after a specified delay. For more information, see "using Animator Sets to orchestrate multiple animations"
 


 

The evaluator tells the property animation system how to calculate the value of a given property. They use the Animator class to provide time series data: the start and end values of the animation, and the attribute animation values calculated based on the data. The property animation system provides the following evaluators:

Table 2. Evaluators

Class/Interface
Description
 
IntEvaluator
The default evaluator is used to evaluate the calculated value of the int type attribute.
 
FlaoatEvaluator
The default evaluator is used to evaluate the calculated value of a float attribute.
 
ArgbEvaluator
The default evaluator is used to evaluate the calculated value of the color attribute. The color attribute value is represented in hexadecimal notation.
 
TypeEvaluator
Allows you to create interfaces for custom evaluators. To make a non-int, float, or color attribute have an animation effect, you must implement this TypeEvaluator interface to specify how to calculate the animation value of the object property. If you want to process animations that are different from int, float, and color default actions, you can also specify a custom TypeEvaluator for them. For details about how to compile a custom evaluator, refer to "using TypeEvaluator"
 


 

The time difference defines a specific value for calculation for the time function in the animation. For example, a linear transition animation means that the animation moves evenly throughout the animation, or, for example, the acceleration starts to reduce the non-linear animation that ends. Table 3 describes the differences contained in the android. view. animation package. If there is no difference that suits your needs, you can implement the TimeInterpolator interface to create your own difference. For more information about how to compile the custom difference value, see "use difference value ".

Table 3. Interpolators

Class/Interface
Description
 
AccelerateDecelerateInterpolator
The change frequency is slow at the beginning and end, while acceleration is in the middle.
 
AccelerateInterpolator
The change frequency starts slowly and then accelerates
 
AnticipateInterpolator
First backward, then throw forward (parabolic motion)
 
AnticipateOvershootInterpolator
First, throw forward and exceed the target value, and then return to the target value.
 
BounceInterpolator
Rebound at end
 
CycleInterpolator
Play the animation repeatedly with the specified number of cycles
 
DecelerateInterpolator
The change frequency is fast-forward and then slow down.
 
LinearInterpolator
Fixed change frequency
 
OvershootInterpolator
Throws forward, exceeds the target value, and then returns
 
TimeInterpolator
An interface for implementing custom Interpolation
 

By FireOfStar

 

 

Related Article

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.