AnimationComponent
Native animation component.
Provides access to a native animation component instance.
- AnimationComponent
- .onEvent: Emitter<[string]>
- .AnimationComponent.TypeName: string
- .animation
- .duration
- .iteration
- .playCount
- .position
- .rootMotionMode
- .speed
- .state
- .getFloatParameter(name) ⇒ null | number
- .getRootMotionRotation<T>(out) ⇒ T
- .getRootMotionTranslation<T>(out) ⇒ T
- .pause() ⇒ void
- .play() ⇒ void
- .setFloatParameter(name, value) ⇒ void
- .stop() ⇒ void
.onEvent: Emitter<[string]>
Emitter for animation events triggered on this component.
The first argument is the name of the event.
.TypeName: string
.animation: null | Animation
Animation set for this component
.animation
Set animation to play.
Make sure to retarget the animation to affect the right objects.
.duration: number
1.2.3+Current duration to loop one iteration in seconds, offers a more accurate duration than duration when blending multiple animations.
.iteration: number
1.2.3+Current iteration of the animation.
If playCount is not unlimited, the value is in the range from
0
to playCount
.
.playCount: number
Number of times the animation is played.
.playCount
Set play count. Set to 0
to loop indefinitely.
.position: number
1.2.3+Current playing position of the animation within the current iteration, in seconds.
The value is in the range from 0.0
to duration,
if playing in reverse, this range is reversed as well.
.rootMotionMode: RootMotionMode
1.2.2+How to handle root motion on this component.
.rootMotionMode
1.2.2+Set how to handle root motion.
.speed: number
0.8.10+Speed factor at which the animation is played.
.speed
0.8.10+Set speed. Set to negative values to run the animation backwards.
Setting speed has an immediate effect for the current frame’s update and will continue with the speed from the current point in the animation.
.state: AnimationState
Current playing state of the animation
.getFloatParameter(name: string) ⇒ null | number
1.2.0+Get the value of a float parameter in the attached graph. Throws if the parameter is missing.
Param | Type | Description |
---|---|---|
name | string | Name of the parameter. |
.getRootMotionRotation<T>(out: T) ⇒ T
.getRootMotionRotation() ⇒ Float32Array
1.2.2+Get the root motion rotation in local space calculated for the current frame.
Note: If rootMotionMode is not set to Script this will always return an identity rotation.
Param | Type | Description |
---|---|---|
out | T |
Template Param | Type Definition |
---|---|
T | extends NumberArray |
.getRootMotionTranslation<T>(out: T) ⇒ T
.getRootMotionTranslation() ⇒ Float32Array
1.2.2+Get the root motion translation in local space calculated for the current frame.
Note: If rootMotionMode is not set to Script this will always return an identity translation.
Param | Type | Description |
---|---|---|
out | T |
Template Param | Type Definition |
---|---|
T | extends NumberArray |
.pause() ⇒ void
Pause animation.
.play() ⇒ void
Play animation.
If the animation is currently paused, resumes from that position. If the animation is already playing, does nothing.
To restart the animation, stop it first.
.setFloatParameter(name: string, value: number) ⇒ void
1.2.0+Set the value of a float parameter in the attached graph Throws if the parameter is missing.
Returns: 1 if the parameter was successfully set, 0 on fail.
Param | Type | Description |
---|---|---|
name | string | Name of the parameter. |
value | number | Float value to set. |
.stop() ⇒ void
Stop animation.