public interface AnimationPlayback
This class is used to play, pause, and stop an animation, and set the playback speed, repeat times, and weight for the animation.
| 限定符和类型 | 接口 | 说明 |
|---|---|---|
static class |
AnimationPlayback.State |
Enumerates animation playback states.
|
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
REPEAT_COUNT_INFINITE |
Indicates that the animation keeps repeating.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
AnimationPlayback.State |
getPlaybackState() |
Obtains the current animation playback state.
|
int |
getRepeatCount() |
Obtains the repeat times of the animation playback.
|
float |
getSpeed() |
Obtains the animation playback speed.
|
float |
getWeight() |
Obtains animation weight used for playing mixed animations.
|
boolean |
isCompleted() |
Checks whether the animation playback is complete.
|
void |
release() |
Releases animation playback data.
|
void |
setPlaybackState(AnimationPlayback.State state) |
Sets the animation playback state.
|
void |
setRepeatCount(int repeatCount) |
Sets the repeat times of the animation playback.
|
void |
setSpeed(float speed) |
Sets the animation playback speed.
|
void |
setWeight(float weight) |
Sets animation weight used for playing mixed animations.
|
static final int REPEAT_COUNT_INFINITE
setRepeatCount(int) to set
infinite playback.void release()
After the animation playback data is released, the animation cannot be played any more.
void setPlaybackState(AnimationPlayback.State state)
state - Indicates the state to set, which is enumerated in State.AnimationPlayback.State getPlaybackState()
void setRepeatCount(int repeatCount)
repeatCount - Indicates the repeat times to set. If you want the playback to keep repeating, set this
parameter to REPEAT_COUNT_INFINITE.int getRepeatCount()
void setWeight(float weight)
weight - Indicates the animation weight to set. The value ranges from 0 to 1. 0.0 indicates that
the animation will not be played, and 1.0 indicates that the entire animation will be played.float getWeight()
0.0 if the animation will not be played; returns 1.0 if the entire animation
will be played.boolean isCompleted()
true if the animation playback is complete; returns false otherwise.void setSpeed(float speed)
1.0.speed - Indicates the playback speed to set.float getSpeed()