Class: AnimationPlayhead

AnimationPlayhead

AnimationPlayhead is a 'helper' class that just updates a play head. Returns the keyframes and the ratio between them. This is for example used in SkeletonClipNode.


new AnimationPlayhead(clip, looping)

Parameters:
Name Type Description
clip AnimationClip

The clip to play.

looping Boolean

Determines whether the animation should loop or not. By default, it uses the value determined by the AnimationClip, but can be overridden.

Author:
  • derschmale <http://www.derschmale.com>

Members


frame1 :number

The first frame before the playhead's current position.

Type:
  • number

frame2 :number

The frame right after the playhead's current position.

Type:
  • number

ratio :number

The ratio of the play head's position between frame1 and frame2. This is used to interpolate between frame1 and frame2's keyframe values.

Type:
  • number

time

The current time in milliseconds of the play head.


wraps :number

The number of times the playhead has wrapped during the last update. Useful when moving skeleton root joint, fe.

Type:
  • number

Methods


play()

Starts updating the play head when update(dt) is called.


stop()

Stops updating the play head when update(dt) is called.


update(dt)

This needs to be called every frame.

Parameters:
Name Type Description
dt

The time passed since last frame in milliseconds.

Returns:

Whether or not the playhead moved. This can be used to spare further calculations if the old state is kept.

Type
boolean