API Docs for:
Show:

LS.Components.PlayAnimation Class

Reads animation tracks from an LS.Animation resource and applies the properties to the objects referenced

Constructor

LS.Components.PlayAnimation

(
  • object
)

Parameters:

  • object String

    to configure from

Methods

applyAnimation

(
  • take
  • time
  • last_time
  • weight
)

applys the animation to the scene nodes

Parameters:

  • take String

    the name of the take

  • time Number

    the time where to sample the tracks

  • last_time Number

    [optional] the last time that was applied, (used to trigger events)

  • weight Number

    [optional] the weight of this animation (used for blending animation), if ommited 1 is used

getAnimation

(
  • name
)
LS.Animation

returns the current animation or an animation with a given name

Parameters:

  • name String

    [optional] the name of the animation, if omited then uses the animation set in the component

Returns:

LS.Animation:

the animation container

getDuration

() Number

Gets the duration of the current take in the current animation

Returns:

Number:

the duration of the take, or -1 if the take was not found or the animation is not loaded

getTake

(
  • take_name
)
Number

returns the current animation or an animation with a given name

Parameters:

  • take_name String

    [optional] if not specified then it uses the current take

Returns:

Number:

the duration of the take, or -1 if the take was not found or the animation is not loaded

pause

()

Pauses the animation

play

()

Resets the time to zero and starts playing the current take of the animation It also triggers a "start_animation" event

playRange

(
  • start
  • end
)

Starts playing the animation but only using a range of it

Parameters:

  • start Number

    start time

  • end Number

    end time

stop

()

Stops the animation and sets the time to zero

Properties

animation

String

the name of the LS.Animation resource where the takes and tracks are stored

mode

Number

how to play the animation, options are: PlayAnimation.LOOP PlayAnimation.PINGPONG PlayAnimation.ONCE PlayAnimation.PAUSED

root_node

String

the root node locator where to apply the animation, is none is specified it is applied using the scene root node if a "@" is set, then only to this node and its children

take

String

the name of the LS.Animation.Take to play from the LS.Animation A take representes a set of tracks