API Reference

Class List

pc.AnimationComponent

Extends: pc.Component

The Animation Component allows an Entity to playback animations on models

Summary

Properties

activateIf true the first animation asset will begin playing when the Pack is loaded
assetsThe array of animation assets - can also be an array of asset ids.
currentTimeGet or Set the current time position (in seconds) of the animation
durationGet the duration in seconds of the current animation.
loopIf true the animation will restart from the beginning when it reaches the end
speedSpeed multiplier for animation play back speed.

Methods

getAnimationReturn an animation
playStart playing an animation

Inherited

Properties

enabledEnables or disables the component.

Details

Constructor

AnimationComponent(system, entity)

Create a new AnimationComponent

Parameters

systempc.AnimationComponentSystemThe pc.ComponentSystem that created this Component
entitypc.EntityThe Entity that this Component is attached to

Properties

Booleanactivate

If true the first animation asset will begin playing when the Pack is loaded

pc.Asset[]assets

The array of animation assets - can also be an array of asset ids.

NumbercurrentTime

Get or Set the current time position (in seconds) of the animation

Numberduration

Get the duration in seconds of the current animation.

Booleanloop

If true the animation will restart from the beginning when it reaches the end

Numberspeed

Speed multiplier for animation play back speed. 1.0 is playback at normal speed, 0.0 pauses the animation

Methods

getAnimation(name)

Return an animation

Parameters

nameStringThe name of the animation asset

Returns

pc.Animation An Animation

play(name, [blendTime])

Start playing an animation

Parameters

nameStringThe name of the animation asset to begin playing.
blendTimeNumberThe time in seconds to blend from the current animation state to the start of the animation being set.

Inherited

Properties

Booleanenabled

Enables or disables the component.