Class: Animation

rune.animation.Animation(name, frames, framerateopt, loopedopt)

The Animation class represents a keyframe based animation sequence.

Constructor

new Animation(name, frames, framerateopt, loopedopt)

Creates a new instance of the Animation class.
Parameters:
Name Type Attributes Default Description
name string The name of the animation; used as a unique ID.
frames Array List of which frames are included in the animation and in which order.
framerate number <optional>
0 Playback speed specified in frames per second.
looped boolean <optional>
false Whether or not to loop the animation sequence.
Source:

Members

(readonly) atlasIndex :number

Describes the current frame based on the animation's atlas texture.
Type:
  • number
Source:

delay :number

The display time (in milliseconds) of each keyframe.
Type:
  • number
Source:

(readonly) duration :number

The total length of the animation specified in milliseconds.
Type:
  • number
Source:

(readonly) frameIndex :number

Index of current keyframe within current animation sequence.
Type:
  • number
Source:

framerate :number

Playback speed specified in frames per second.
Type:
  • number
Source:

frames :Array

List of animation key frames. The list dictates which frames are included in the animation and in which order the frames are played.
Type:
  • Array
Source:

(readonly) isPlaying :boolean

A Boolean value that indicates whether an animation is currently playing.
Type:
  • boolean
Source:

(readonly) length :number

Length of animation, indicated in number of frames.
Type:
  • number
Source:

looped :boolean

Whether (true) or not (false) to loop the animation sequence.
Type:
  • boolean
Source:

(readonly) name :string

The name of the animation. This value is used as a unique ID and thus there can be no two animations with the same name.
Type:
  • string
Source:

(readonly) scripts :rune.animation.AnimationScripts

Refers to a subsystem that enables the inclusion of scripts in frames. Use this reference to add, or delete, scripts for the current animation.
Type:
Source:

Methods

goto(frame) → {undefined}

Jumps to a specific frame within the animation sequence.
Parameters:
Name Type Description
frame number Frame to go to.
Source:
Returns:
Type
undefined

gotoAndPlay(frame) → {undefined}

Jumps to a specific frame within the animation sequence and starts playback from this location.
Parameters:
Name Type Description
frame number Frame to go to.
Source:
Returns:
Type
undefined

gotoAndStop(frame) → {undefined}

Jumps to a specific frame within the animation sequence and stops playback on that frame.
Parameters:
Name Type Description
frame number Frame to go to.
Source:
Returns:
Type
undefined

gotoNextFrame() → {undefined}

Sends the playhead to the next frame.
Source:
Returns:
Type
undefined

gotoPreviousFrame() → {undefined}

Sends the playhead to the previous frame.
Source:
Returns:
Type
undefined

gotoRandomFrame() → {undefined}

Sends the playhead to a random frame.
Source:
Returns:
Type
undefined

play() → {undefined}

Moves the playhead in the timeline of the animation.
Source:
Returns:
Type
undefined

stop() → {undefined}

Stops the playhead in the animation.
Source:
Returns:
Type
undefined