Constructor
new AnimationComponent(system, entity)
Create a new AnimationComponent
Parameters:
Name | Type | Description |
---|---|---|
system |
pc.AnimationComponentSystem | The pc.ComponentSystem that created this Component |
entity |
pc.Entity | The Entity that this Component is attached to |
Properties:
Name | Type | Description |
---|---|---|
speed |
Number | Speed multiplier for animation play back speed. 1.0 is playback at normal speed, 0.0 pauses the animation |
loop |
Boolean | If true the animation will restart from the beginning when it reaches the end |
activate |
Boolean | If true the first animation asset will begin playing when the scene is loaded |
assets |
Array.<pc.Asset> | The array of animation assets - can also be an array of asset ids. |
currentTime |
Number | Get or Set the current time position (in seconds) of the animation |
duration |
Number | Get the duration in seconds of the current animation. |
Extends
Methods
getAnimation(name) → {pc.Animation}
Return an animation
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The name of the animation asset |
Returns:
An Animation
- Type
- pc.Animation
play(name, blendTimeopt)
Start playing an animation
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String | The name of the animation asset to begin playing. | |
blendTime |
Number |
<optional> |
The time in seconds to blend from the current animation state to the start of the animation being set. |