Constructor
new Animator(optionsopt)
- Source:
- See:
Name | Type | Description |
---|---|---|
options ? |
Partial<T & AnimatorOptions> | animator's options |
Example
const animator = new Animator({
delay: 2,
diretion: "alternate",
duration: 2,
fillMode: "forwards",
iterationCount: 3,
easing: Scene.easing.EASE,
});
Extends
- EventTrigger
Methods
end() → {Animator}
end animator
Returns:
An instance itself.
- Type
- Animator
finish() → {Animator}
end animator
Returns:
An instance itself.
- Type
- Animator
getActiveDuration(delayopt) → {number}
Get the animator's total duration excluding delay
Name | Type | Description |
---|---|---|
delay ? |
boolean |
Example
animator.getActiveDuration();
Returns:
Total duration excluding delay
- Type
- number
getDelay() → {number}
Get a delay for the start of an animation.
Returns:
delay
- Type
- number
getDirection() → {DirectionType}
Get whether an animation should be played forwards, backwards or in alternate cycles.
Returns:
direction
- Type
- DirectionType
getDuration() → {number}
Get how long an animation should take to complete one cycle.
Returns:
duration
- Type
- number
getEasing() → {EasingType}
Get the speed curve of an animation.
Returns:
easing
- Type
- EasingType
getEasingName() → {string}
Get the speed curve's name
Returns:
the curve's name.
- Type
- string
getFillMode() → {FillModeType}
Get fill mode for the item when the animation is not playing (before it starts, after it ends, or both)
Returns:
fillMode
- Type
- FillModeType
getId() → {number|string}
Specifies the unique indicator of the animator
Returns:
the indicator of the item.
- Type
- number | string
getIterationCount() → {IterationCountType}
Get the number of times an animation should be played.
Returns:
iterationCount
- Type
- IterationCountType
getIterationTime() → {number}
Get the animator's current iteration time
Example
animator.getIterationTime();
Returns:
current iteration time
- Type
- number
getPlaySpeed() → {number}
Get the animator's play speed
Returns:
playSpeed
- Type
- number
getPlayState() → {PlayStateType}
Get whether the animation is running or paused.
Returns:
playState
- Type
- PlayStateType
getTime() → {number}
Get the animator's current time
Example
animator.getTime();
Returns:
current time
- Type
- number
getTotalDuration() → {number}
Get the animator's total duration including delay
Example
animator.getTotalDuration();
Returns:
Total duration
- Type
- number
isDelay() → {boolean}
Check if the current state of animator is delayed.
Returns:
check delay state
- Type
- boolean
isEnded() → {boolean}
Check if the animator has reached the end.
Example
animator.isEnded(); // true or false
Returns:
ended
- Type
- boolean
isPaused() → {boolean}
Check if the animator is paused:
Example
animator.isPaused(); // true or false
Returns:
paused
- Type
- boolean
pause() → {Animator}
pause animator
Returns:
An instance itself.
- Type
- Animator
play(toTimeopt) → {Animator}
play animator
Name | Type | Description |
---|---|---|
toTime ? |
number |
Returns:
An instance itself.
- Type
- Animator
setDelay(delay) → {Animator}
Set a delay for the start of an animation.
Name | Type | Description |
---|---|---|
delay |
number | delay |
Returns:
An instance itself.
- Type
- Animator
setDirection(direction) → {Animator}
Set whether an animation should be played forwards, backwards or in alternate cycles.
Name | Type | Description |
---|---|---|
direction |
DirectionType | direction |
Returns:
An instance itself.
- Type
- Animator
setDuration(duration) → {Animator}
Set how long an animation should take to complete one cycle.
Name | Type | Description |
---|---|---|
duration |
number | duration |
Returns:
An instance itself.
- Type
- Animator
setEasing(curverArray) → {Animator}
set animator's easing.
Name | Type | Description |
---|---|---|
curverArray |
string | number[] | EasingFunction | The speed curve of an animation. |
Example
animator.({
delay: 2,
diretion: "alternate",
duration: 2,
fillMode: "forwards",
iterationCount: 3,
easing: Scene.easing.EASE,
});
Returns:
An instance itself.
- Type
- Animator
setFillMode(fillMode) → {Animator}
Set fill mode for the item when the animation is not playing (before it starts, after it ends, or both)
Name | Type | Description |
---|---|---|
fillMode |
FillModeType | fillMode |
Returns:
An instance itself.
- Type
- Animator
setId() → {Animator}
Specifies the unique indicator of the animator
Type | Description |
---|---|
number | string | String or number of id to be set in the animator |
Returns:
An instance itself.
- Type
- Animator
setIterationCount(iterationCount) → {Animator}
Set the number of times an animation should be played.
Name | Type | Description |
---|---|---|
iterationCount |
IterationCountType | iterationCount |
Returns:
An instance itself.
- Type
- Animator
setOptions(optionsopt) → {Animator}
- Source:
- See:
set animator's options.
Name | Type | Default | Description |
---|---|---|---|
options ? |
Partial<AnimatorOptions> |
{}
|
animator's options |
Example
animator.({
delay: 2,
diretion: "alternate",
duration: 2,
fillMode: "forwards",
iterationCount: 3,
easing: Scene.eaasing.EASE,
});
Returns:
An instance itself.
- Type
- Animator
setPlaySpeed(playSpeed) → {Animator}
Set the animator's play speed
Name | Type | Description |
---|---|---|
playSpeed |
number | playSpeed |
Returns:
An instance itself.
- Type
- Animator
setPlayState(playState) → {Animator}
Set whether the animation is running or paused.
Name | Type | Description |
---|---|---|
playState |
PlayStateType | playState |
Returns:
An instance itself.
- Type
- Animator
setTime(time, isTickopt, isParentopt) → {Animator}
set currentTime
Name | Type | Description |
---|---|---|
time |
Number | String | currentTime |
isTick ? |
boolean | |
isParent ? |
boolean |
Example
animator.setTime("from"); // 0
animator.setTime("to"); // 100%
animator.setTime("50%");
animator.setTime(10);
animator.getTime() // 10
Returns:
An instance itself.
- Type
- Animator
Events
ended
This event is fired when animator is ended.
iteration
The event is fired when an iteration of an animation ends.
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
param |
Object | The object of data to be sent to an event.
Properties
|
paused
This event is fired when animator is paused.
play
This event is fired when play animator.
timeupdate
This event is fired when the animator updates the time.
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
param |
Object | The object of data to be sent to an event.
Properties
|