API Docs for: 1.1.1
Show:

Kiwi.Animations.Animation Class

Module: Animations
Parent Module: Kiwi

An Animation contains information about a single animation that is held on a AnimationManager. The information that is held is unique to this individual animation and will initially be the same as a Sequence, but if you do ever modify the information held in this Animation the corresponding Sequence will not be updated.

Constructor

Kiwi.Animations.Animation

(
  • name
  • sequences
  • clock
  • parent
)
Kiwi.Animations.Anim

Parameters:

  • name String

    The name of this anim.

  • sequences Kiwi.Animations.Sequences

    The sequence that this anim will be using to animate.

  • clock Kiwi.Time.Clock

    A game clock that this anim will be using to keep record of the time between frames.

  • parent Kiwi.Components.AnimationManager

    The animation manager that this animation belongs to.

Returns:

Kiwi.Animations.Anim:

Methods

_start

(
  • [index=null]
)
private

An Internal method used to start the animation.

Parameters:

  • [index=null] Number optional

    The index of the frame in the sequence that is to play. If left as null if just starts from where it left off.

_validateFrame

(
  • frame
)
private

An internal method used to check to see if frame passed is valid or not

Parameters:

  • frame Number

    The index of the frame that is to be validated.

destroy

() public

Destroys the anim and all of the properties that exist on it.

nextFrame

() public

Makes the animation go to the next frame. If the animation is at the end it goes back to the start.

objType

() String public

The type of object that this is.

Returns:

String:

pause

() public

Pauses the current animation.

play

() public

Plays the animation.

playAt

(
  • index
)
public

Plays the animation at a particular frame

Parameters:

  • index Number

    The index of the cell in the sequence that the animation is to start at.

prevFrame

() public

Makes the animation go to the previous frame. If the animation is at the first frame it goes to the end.

resume

() public

Resumes the current animation after stopping.

stop

() public

Stops the current animation from playing.

update

() public

The update loop. Returns a boolean indicating whether the animation has gone to a new frame or not.

Properties

_clock

Kiwi.Time.Clock private

The clock that is to be used to calculate the animations.

_frameIndex

Number private

The current frame index that the animation is currently upto. Note: A frame index is the index of a particular cell in the Sequence.

_isPlaying

Boolean private

If the animation is currently playing or not.

Default: false

_loop

Boolean private

If this animation should loop or not.

_onLoop

Kiwi.Signal public

A Kiwi.Signal that dispatches an event when the animation has come to the end of the animation and is going to play again.

_onPlay

Kiwi.Signal public

A Kiwi.Signal that dispatches an event when the animation has started playing.

_onStop

Signal public

A Kiwi.Signal that dispatches an event when the animation has stopped playing.

_onUpdate

Kiwi.Signal public

A Kiwi.Signal that dispatches an event when the animation has updated/changed frameIndexs.

_parent

Kiwi.Components.AnimationManager private

The AnimationManager that this animation is a child of.

_reverse

Boolean private

Indicates whether the animation is playing in reverse or not.

_sequence

Kiwi.Animations.Sequence private

The sequence on the texture atlas that this animation is based off.

_speed

Number private

How fast the transition is between cells. Perhaps change to frames per second to reflect actual game speed?

_startTime

Number private

The starting time of the animation from when it was played. Internal use only.

_tick

Number private

The time at which the animation should change to the next cell

currentCell

Number public

Returns the current cell that the animation is up to. This is READ ONLY.

frameIndex

Number public

The current frame index that the animation is currently upto. Note: A frame index is the index of a particular cell in the Sequence.

isPlaying

Boolean private

If the animation is currently playing or not.

length

Number public

Returns the number of frames that in the animation. Thus the animations 'length'. Note this is READ ONLY.

loop

Boolean public

If once the animation reaches the end, it should start again from the first cell in the sequence or not.

name

String public

The name of this animation.

reverse

Boolean public

Whether the animation is to be played in reverse.

speed

Number public

How long the each cell should stay on screen for. In seconds.