Options
Menu

Class SkeletonAnimator

Provides an interface for assigning skeleton-based animation data sets to sprite-based entity objects and controlling the various available states of animation through an interative playhead that can be automatically updated or manually triggered.

Hierarchy

  • AnimatorBase

Implements

  • IAsset
  • IAssetAdapter
  • IAnimator

Index

Constructors

constructor

  • Creates a new SkeletonAnimator object.

    Parameters

    • animationSet: SkeletonAnimationSet
    • skeleton: Skeleton

      The skeleton object used for calculating the resulting global matrices for transforming skinned sprite data.

    • Default value forceCPU: boolean = false

      Optional value that only allows the animator to perform calculation on the CPU. Defaults to false.

    Returns SkeletonAnimator

Properties

_adapter

_adapter: IAssetAdapter

_pAbsoluteTime

_pAbsoluteTime: number

_pActiveAnimationName

_pActiveAnimationName: string

_pActiveNode

_pActiveNode: AnimationNodeBase

_pActiveState

_pActiveState: IAnimationState

_pAnimationSet

_pAnimationSet: IAnimationSet

_pOwners

_pOwners: Array<IEntity>

absoluteTime

absoluteTime: number

Returns the internal absolute time of the animator, calculated by the current time and the playback speed.

see

#time

see

#playbackSpeed

activeAnimation

activeAnimation: AnimationNodeBase

Returns the current active animation node.

activeAnimationName

activeAnimationName: string

Returns the current active animation node.

activeState

activeState: IAnimationState

Returns the current active animation state.

adaptee

adaptee: AssetBase

adapter

adapter: IAssetAdapter

adapter is used to provide MovieClip to scripts taken from different platforms setter typically managed by factory. getter defaults to AwayJS class

animationSet

animationSet: IAnimationSet

Returns the animation data set in use by the animator.

assetFullPath

assetFullPath: Array<string>

assetNamespace

assetNamespace: string

assetType

assetType: string
inheritdoc

autoUpdate

autoUpdate: boolean

Determines whether the animators internal update mechanisms are active. Used in cases where manual updates are required either via the time property or update() method. Defaults to true.

see

#time

see

#update()

id

id: number

A unique id for the asset, used to identify assets in an associative array

name

name: string

originalName

originalName: string

The original name used for this asset in the resource (e.g. file) in which it was found. This may not be the same as name, which may have changed due to of a name conflict.

playbackSpeed

playbackSpeed: number

The amount by which passed time should be scaled. Used to slow down or speed up animations. Defaults to 1.

time

time: number

Gets and sets the internal time clock of the animator.

updatePosition

updatePosition: boolean

Enables translation of the animated graphics from data returned per frame via the positionDelta property of the active animation node. Defaults to true.

see

away.animators.IAnimationState#positionDelta

Static DEFAULT_NAMESPACE

DEFAULT_NAMESPACE: string

Static ID_COUNT

ID_COUNT: number

Static assetType

assetType: string

Accessors

forceCPU

  • get (): boolean
  • Indicates whether the skeleton animator is disabled by default for GPU rendering, something that allows the animator to perform calculation on the GPU. Defaults to false.

    Returns boolean

globalMatrices

  • get (): Float32Array
  • returns the calculated global matrices of the current skeleton pose.

    see

    #globalPose

    Returns Float32Array

globalPose

  • returns the current skeleton pose output from the animator.

    see

    away.animators.data.SkeletonPose

    Returns SkeletonPose

skeleton

  • Returns the skeleton object in use by the animator - this defines the number and heirarchy of joints used by the skinned geoemtry to which skeleon animator is applied.

    Returns Skeleton

useCondensedIndices

  • get (): boolean
  • set (value: boolean): void
  • Offers the option of enabling GPU accelerated animation on skeletons larger than 32 joints by condensing the number of joint index values required per sprite. Only applicable to skeleton animations that utilise more than one sprite object. Defaults to false.

    Returns boolean

  • Offers the option of enabling GPU accelerated animation on skeletons larger than 32 joints by condensing the number of joint index values required per sprite. Only applicable to skeleton animations that utilise more than one sprite object. Defaults to false.

    Parameters

    • value: boolean

    Returns void

Methods

_pUpdateDeltaTime

  • _pUpdateDeltaTime(dt: number): void
  • Applies the calculated time delta to the active animation state node or state transition object.

    Parameters

    • dt: number

    Returns void

addEventListener

  • addEventListener(type: string, listener: function): void
  • Add an event listener

    method

    addEventListener

    Parameters

    • type: string
    • listener: function
        • (event: EventBase): void
        • Parameters

          • event: EventBase

          Returns void

    Returns void

Private addOwner

  • addOwner(entity: IEntity): void
  • Used by the graphics object to which the animator is applied, registers the owner for internal use.

    Parameters

    • entity: IEntity

    Returns void

assetPathEquals

  • assetPathEquals(name: string, ns: string): boolean
  • Parameters

    • name: string
    • ns: string

    Returns boolean

clear

  • clear(): void
  • Returns void

clone

  • clone(): AnimatorBase
  • inheritdoc

    Returns AnimatorBase

Private dispatchCycleEvent

  • dispatchCycleEvent(): void
  • for internal use.

    Returns void

dispatchEvent

  • dispatchEvent(event: EventBase): void
  • Dispatch an event

    method

    dispatchEvent

    Parameters

    • event: EventBase

    Returns void

dispose

  • dispose(): void
  • inheritdoc

    Returns void

getAnimationState

  • getAnimationState(node: AnimationNodeBase): IAnimationState
  • Parameters

    • node: AnimationNodeBase

    Returns IAnimationState

getAnimationStateByName

  • getAnimationStateByName(name: string): IAnimationState
  • Parameters

    • name: string

    Returns IAnimationState

getRenderableElements

  • getRenderableElements(renderable: GL_ShapeRenderable, sourceElements: TriangleElements): TriangleElements
  • Parameters

    • renderable: GL_ShapeRenderable
    • sourceElements: TriangleElements

    Returns TriangleElements

hasEventListener

  • hasEventListener(type: string, listener?: function): boolean
  • check if an object has an event listener assigned to it

    method

    hasListener

    Parameters

    • type: string
    • Optional listener: function
        • (event: EventBase): void
        • Parameters

          • event: EventBase

          Returns void

    Returns boolean

invalidate

  • invalidate(): void
  • Returns void

invalidateElements

  • invalidateElements(): void
  • Returns void

isAsset

  • isAsset(assetClass: IAssetClass): boolean
  • Parameters

    • assetClass: IAssetClass

    Returns boolean

morphElements

  • morphElements(renderable: GL_ShapeRenderable, sourceElements: TriangleElements): void
  • If the animation can't be performed on GPU, transform vertices manually

    Parameters

    • renderable: GL_ShapeRenderable
    • sourceElements: TriangleElements

    Returns void

phase

  • phase(value: number): void
  • Sets the animation phase of the current active state's animation clip(s).

    Parameters

    • value: number

      The phase value to use. 0 represents the beginning of an animation clip, 1 represents the end.

    Returns void

play

  • Plays an animation state registered with the given name in the animation data set.

    Parameters

    • name: string

      The data set name of the animation state to be played.

    • Default value transition: IAnimationTransition = null

      An optional transition object that determines how the animator will transition from the currently active animation state.

    • Default value offset: number = NaN

      An option offset time (in milliseconds) that resets the state's internal clock to the absolute time of the animator plus the offset value. Required for non-looping animation states.

    Returns void

removeEventListener

  • removeEventListener(type: string, listener: function): void
  • Remove an event listener

    method

    removeEventListener

    Parameters

    • type: string
    • listener: function
        • (event: EventBase): void
        • Parameters

          • event: EventBase

          Returns void

    Returns void

Private removeOwner

  • removeOwner(entity: IEntity): void
  • Used by the graphics object from which the animator is removed, unregisters the owner for internal use.

    Parameters

    • entity: IEntity

    Returns void

reset

  • reset(name: string, offset?: number): void
  • Parameters

    • name: string
    • Optional offset: number

    Returns void

resetAssetPath

  • resetAssetPath(name: string, ns?: string, overrideOriginal?: boolean): void
  • Parameters

    • name: string
    • Optional ns: string
    • Optional overrideOriginal: boolean

    Returns void

setRenderState

  • setRenderState(shader: ShaderBase, renderable: GL_RenderableBase, stage: Stage, projection: ProjectionBase): void
  • inheritdoc

    Parameters

    • shader: ShaderBase
    • renderable: GL_RenderableBase
    • stage: Stage
    • projection: ProjectionBase

    Returns void

start

  • start(): void
  • Resumes the automatic playback clock controling the active state of the animator.

    Returns void

stop

  • stop(): void
  • Pauses the automatic playback clock of the animator, in case manual updates are required via the time property or update() method.

    see

    #time

    see

    #update()

    Returns void

testGPUCompatibility

  • testGPUCompatibility(shader: ShaderBase): void
  • inheritdoc

    Parameters

    • shader: ShaderBase

    Returns void

update

  • update(time: number): void
  • Provides a way to manually update the active state of the animator when automatic updates are disabled.

    see

    #stop()

    see

    #autoUpdate

    Parameters

    • time: number

    Returns void

updateFullPath

  • updateFullPath(): void
  • Returns void

Generated using TypeDoc