API Overview
你可以在android.animation中找到大部分的屬性動畫系統,因為在andorid.view.animation中已定義了許多interpolator了,你可以在屬性動畫系統使用這些interpolator,以下表格描述了屬性動畫系統主要的組件。
Animator類別提供建立動畫的基礎架構。正常來說你不需要直接使用到animator類別,它只提供延伸支持全部的動畫的最小的功能。以下為繼承自animator的類別。
Class | Description |
---|---|
ValueAnimator | The main timing engine for property animation that also computes the values for the property to be animated. It has all of the core functionality that calculates animation values and contains the timing details of each animation, information about whether an animation repeats, listeners that receive update events, and the ability to set custom types to evaluate. There are two pieces to animating properties: calculating the animated values and setting those values on the object and property that is being animated. ValueAnimator does not carry out the second piece, so you must listen for updates to values calculated by the ValueAnimator and modify the objects that you want to animate with your own logic. See the section about Animating with ValueAnimator for more information. |
ObjectAnimator | A subclass of ValueAnimator that allows you to set a target object and object property to animate. This class updates the property accordingly when it computes a new value for the animation. You want to use ObjectAnimator most of the time, because it makes the process of animating values on target objects much easier. However, you sometimes want to use ValueAnimator directly because ObjectAnimator has a few more restrictions, such as requiring specific acessor methods to be present on the target object. |
AnimatorSet | Provides a mechanism to group animations together so that they run in relation to one another. You can set animations to play together, sequentially, or after a specified delay. See the section about Choreographing multiple animations with Animator Sets for more information. |
Class/Interface | Description |
---|---|
IntEvaluator | The default evaluator to calculate values for int properties. |
FloatEvaluator | The default evaluator to calculate values for float properties. |
ArgbEvaluator | The default evaluator to calculate values for color properties that are represented as hexidecimal values. |
TypeEvaluator | An interface that allows you to create your own evaluator. If you are animating an object property that is not an int , float , or color, you must implement the TypeEvaluator interface to specify how to compute the object property's animated values. You can also specify a customTypeEvaluator for int , float , and color values as well, if you want to process those types differently than the default behavior. See the section about Using a TypeEvaluator for more information on how to write a custom evaluator. |
TimeInterpolator定義如何在動畫中的數值作為工的能時序,例如,你可以指定整個動畫為線性,或者你可以動畫為非線性的,例如,在動畫開始為加速,動畫結束時減速。表三顯示在android.view.animation中的interpolator。如果沒有合適你需要的interpolator,你可以實現TimeInterpolator介面和創建你自己的。你可以在Using interpolators文章中了解更多資訊與如何自定義interpolator。
Class/Interface | Description |
---|---|
AccelerateDecelerateInterpolator | An interpolator whose rate of change starts and ends slowly but accelerates through the middle. |
AccelerateInterpolator | An interpolator whose rate of change starts out slowly and then accelerates. |
AnticipateInterpolator | An interpolator whose change starts backward then flings forward. |
AnticipateOvershootInterpolator | An interpolator whose change starts backward, flings forward and overshoots the target value, then finally goes back to the final value. |
BounceInterpolator | An interpolator whose change bounces at the end. |
CycleInterpolator | An interpolator whose animation repeats for a specified number of cycles. |
DecelerateInterpolator | An interpolator whose rate of change starts out quickly and and then decelerates. |
LinearInterpolator | An interpolator whose rate of change is constant. |
OvershootInterpolator | An interpolator whose change flings forward and overshoots the last value then comes back. |
TimeInterpolator | An interface that allows you to implement your own interpolator. |
沒有留言:
張貼留言