public class AbilitySliceAnimator extends Object
AbilitySlice instances.
You can set different parameters to implement different transition effects. Currently, only translate is supported. Rotate, alpha, and scale operations will be supported later.
The transition properties can be set by calling the onStart() method of the Ability. The default
constructor is used to set the translation animation. To disable the transition animation, you can set the value of
setAbilitySliceAnimator to null. Example code:
protected void onStart(Intent intent) {
setAbilitySliceAnimator(new AbilitySliceAnimator());
}SystemCapability.Aafwk#ABILITY| 构造器 | 说明 |
|---|---|
AbilitySliceAnimator() |
A no-argument constructor used to enable right-to-left translation of ability slices.
|
AbilitySliceAnimator(float fromX,
float fromY,
float toX,
float toY) |
A parameterized constructor used to set the coordinates of the start and end positions for the translation.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
AbilitySliceAnimator |
setDelay(long delay) |
Sets the delay for playing an animation.
|
AbilitySliceAnimator |
setDuration(long duration) |
Sets the duration of an animation.
|
AbilitySliceAnimator |
setRepeatCount(int repeatCount) |
Sets the number of times that an animation play will be repeated.
|
public AbilitySliceAnimator()
public AbilitySliceAnimator(float fromX,
float fromY,
float toX,
float toY)
The origin of coordinates is the upper-left corner on a screen. For example, if you move a view from (1080, 0) to (0, 0), the view is translated horizontally from right to left.
fromX - Indicates the X coordinate of the translation start position.fromY - Indicates the Y coordinate of the translation start position.toX - Indicates the X coordinate of the translation end position.toY - Indicates the Y coordinate of the translation end position.public AbilitySliceAnimator setDuration(long duration)
duration - Indicates the duration for playing the animation, in milliseconds.AbilitySliceAnimator instance.public AbilitySliceAnimator setDelay(long delay)
delay - Indicates the delay for playing the animation, in milliseconds.AbilitySliceAnimator instance.public AbilitySliceAnimator setRepeatCount(int repeatCount)
0, indicating
that the animation will be played only once.repeatCount - Indicates the number of times that the animation play will be repeated.AbilitySliceAnimator instance.