Animatable

Class used to store an actual running animation

Hierarchy

  • Animatable

Index

Constructors

constructor

  • new Animatable(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: function | null | undefined, animations?: Animation[]): Animatable
  • Creates a new Animatable

    Parameters

    • scene: Scene

      defines the hosting scene

    • target: any

      defines the target object

    • Optional fromFrame: number

      defines the starting frame number (default is 0)

    • Optional toFrame: number

      defines the ending frame number (default is 100)

    • Optional loopAnimation: boolean

      defines if the animation must loop (default is false)

    • Optional speedRatio: number

      defines the factor to apply to animation speed (default is 1)

    • Optional onAnimationEnd: function | null | undefined

      defines a callback to call when animation ends if it is not looping

    • Optional animations: Animation[]

      defines a group of animation to add to the new Animatable

    Returns Animatable

Properties

animationStarted

animationStarted: boolean

Gets a boolean indicating if the animation has started

disposeOnEnd

disposeOnEnd: boolean

Gets or sets a boolean indicating if the animatable must be disposed and removed at the end of the animation. This will only apply for non looping animation (default is true)

fromFrame

fromFrame: number

defines the starting frame number (default is 0)

loopAnimation

loopAnimation: boolean

defines if the animation must loop (default is false)

masterFrame

masterFrame: number

Gets the current frame of the first RuntimeAnimation Used to synchronize Animatables

Optional onAnimationEnd

onAnimationEnd: function | null | undefined

defines a callback to call when animation ends if it is not looping

onAnimationEndObservable

onAnimationEndObservable: Observable<Animatable>

Observer raised when the animation ends

speedRatio

speedRatio: number

Gets or sets the speed ratio to apply to the animatable (1.0 by default)

syncRoot

syncRoot: Animatable

Gets the root Animatable used to synchronize and normalize animations

target

target: any

defines the target object

toFrame

toFrame: number

defines the ending frame number (default is 100)

weight

weight: number

Gets or sets the animatable weight (-1.0 by default meaning not weighted)

Methods

appendAnimations

  • appendAnimations(target: any, animations: Animation[]): void
  • Adds more animations to the current animatable

    Parameters

    • target: any

      defines the target of the animations

    • animations: Animation[]

      defines the new animations to add

    Returns void

disableBlending

  • disableBlending(): void

enableBlending

  • enableBlending(blendingSpeed: number): void

getAnimationByTargetProperty

  • Gets the source animation for a specific property

    Parameters

    • property: string

      defines the propertyu to look for

    Returns Nullable<Animation>

    null or the source animation for the given property

getAnimations

  • Gets the list of runtime animations

    Returns RuntimeAnimation[]

    an array of RuntimeAnimation

getRuntimeAnimationByTargetProperty

  • Gets the runtime animation for a specific property

    Parameters

    • property: string

      defines the propertyu to look for

    Returns Nullable<RuntimeAnimation>

    null or the runtime animation for the given property

goToFrame

  • goToFrame(frame: number): void
  • Jump directly to a given frame

    Parameters

    • frame: number

      defines the frame to jump to

    Returns void

pause

  • pause(): void
  • Pause the animation

    Returns void

reset

  • reset(): void
  • Resets the animatable to its original state

    Returns void

restart

  • restart(): void
  • Restart the animation

    Returns void

stop

  • stop(animationName?: string, targetMask?: function): void
  • Stop and delete the current animation

    Parameters

    • Optional animationName: string

      defines a string used to only stop some of the runtime animations instead of all

    • Optional targetMask: function

      a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)

        • (target: any): boolean
        • Parameters

          • target: any

          Returns boolean

    Returns void

syncWith

  • Synchronize and normalize current Animatable with a source Animatable This is useful when using animation weights and when animations are not of the same length

    Parameters

    • root: Animatable

      defines the root Animatable to synchronize with

    Returns Animatable

    the current Animatable

waitAsync

  • Wait asynchronously for the animation to end

    Returns Promise<Animatable>

    a promise which will be fullfilled when the animation ends

Generated using TypeDoc