Skip to content

CaseAnimation

MikhailTymchukDX edited this page Apr 12, 2017 · 2 revisions

CaseAnimation (inherits SelectionAnimation)

The CaseAnimation is used as a control structure to play a specific child animation depending on the result of executing the selectScript, which should return the index of the child animation to play (this is similar to the case or select statements in C#/VB, etc.). If the provided index is outside the bounds of the child animations array (or if nothing was returned) then we will not play anything.

Client properties

Name Description
selectScript JavaScript that should evaluate to the index of the appropriate child animation to play. If this returns an index outside the bounds of the child animations array, then nothing is played.

Client methods

Name Description
constructor(target, duration, fps, animations, selectScript)
getSelectedIndex() Get the index of the animation that is selected to be played. If this returns an index outside the bounds of the child animations array, then nothing is played.

Client properties

selectScript

JavaScript that should evaluate to the index of the appropriate child animation to play. If this returns an index outside the bounds of the child animations array, then nothing is played.

Getter name: get_selectScript()
Setter name: set_selectScript(value)

Client methods

constructor(target, duration, fps, animations, selectScript)

Params:

  • target

    • Type: Object
    • Description: Target of the animation.
  • duration

    • Type: Number
    • Description: Length of the animation in seconds. The default is 1.
  • fps

    • Type: Number
    • Description: Number of steps per second. The default is 25.
  • animations

    • Type: Object
    • Description: Array of child animations to be played.
  • selectScript

    • Type: Object
    • Description: JavaScript that should evaluate to the index of the appropriate child animation to play. If this returns an index outside the bounds of the child animations array, then nothing is played.

getSelectedIndex()

Get the index of the animation that is selected to be played. If this returns an index outside the bounds of the child animations array, then nothing is played.

Clone this wiki locally