Class Info |
|---|
public class Animator extends Component 动画播放器组件。 |
Qualifier and Type | Method Name and Description |
|---|---|
void | apply(boolean value) 设置动画是否开启单帧播放。 |
static Component.Descriptor<Animator> | 获取动画播放器组件描述符。 |
List<String> | 获取所有动画的名称。 |
String | 获取播放中的动画名称。 |
setSpeed(float speed) 设置动画播放速度。 | |
| 获取当前动画播放状态。 | |
boolean | 获取动画是否倒放。 |
boolean | 获取动画是否循环播放。 |
pause() 暂停动画。 | |
play(String name) 播放动画。 | |
setInverse(boolean inverse) 设置动画是否倒放。 | |
setRecycle(boolean recycle) 设置动画是否循环播放。 | |
setSpeed(float speed) 设置动画播放速度。 | |
void | step(float time) 设置动画播放单帧的时间。 |
stop() 停止动画。 |
Method |
|---|
public void apply(boolean value) 设置动画是否开启单帧播放。单帧播放时,动画将只播放某个时间点的动画效果,需配合step使用。 |
Parameters
Name | Description |
|---|---|
value |
|
Method |
|---|
public static Component.Descriptor<Animator> descriptor() 获取动画播放器组件描述符。 |
Returns
Type | Description |
|---|---|
动画播放器组件描述符。 |
Method |
|---|
public List<String> getAnimations() 获取所有动画的名称。 |
Returns
Type | Description |
|---|---|
List<String> | 包含所有动画名称的列表。 |
Method |
|---|
public String getPlayingAnimation() 获取当前正在播放的动画名称。 |
Returns
Type | Description |
|---|---|
String | 当前正在播放的动画名称。 |
Method |
|---|
public Animator.AnimationStatus getStatus() 获取当前播放的动画状态。 |
Returns
Type | Description |
|---|---|
当前播放的动画状态。 |
Method |
|---|
public boolean isInverse() 获取动画是否倒放。 |
Returns
Type | Description |
|---|---|
boolean | 动画是否倒放。
|
Method |
|---|
public boolean isRecycle() 获取动画是否循环。 |
Returns
Type | Description |
|---|---|
boolean | 动画是否循环。
|
Method |
|---|
public Animator play(String name) 播放动画。默认动画以1.0f的播放速度正序循环播放。 |
Parameters
Name | Description |
|---|---|
name | 需要播放的动画名称。 |
Returns
Type | Description |
|---|---|
自身实例。 |
Method |
|---|
public Animator setInverse(boolean inverse) 设置动画是否倒放。 |
Parameters
Name | Description |
|---|---|
inverse | 动画是否倒序播放。
|
Returns
Type | Description |
|---|---|
自身实例。 |
Method |
|---|
public Animator setRecycle(boolean recycle) 设置动画是否循环播放。 |
Parameters
Name | Description |
|---|---|
recycle | 动画是否循环播放。
|
Returns
Type | Description |
|---|---|
自身实例。 |
Method |
|---|
public Animator setSpeed(float speed) 设置动画播放速度。 |
Parameters
Name | Description |
|---|---|
speed | 动画播放速度。
|
Returns
Type | Description |
|---|---|
自身实例。 |
Method |
|---|
public void step(float time) 设置动画播放单帧的时间。单帧播放时,动画将只播放某个时间点的动画效果,需使用apply开启。 |
Parameters
Name | Description |
|---|---|
time | 播放动画单帧的时间,取值范围[0,当前播放动画的总时长]。 |