Animatable

Class used to store an actual running animation

Hierarchy

  • Animatable

Index

Constructors

constructor

Find examples in Playground
  • 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

Find examples in Playground
animationStarted: boolean

Gets a boolean indicating if the animation has started

disposeOnEnd

Find examples in Playground
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

Find examples in Playground
fromFrame: number

defines the starting frame number (default is 0)

loopAnimation

Find examples in Playground
loopAnimation: boolean

defines if the animation must loop (default is false)

masterFrame

Find examples in Playground
masterFrame: number

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

Optional onAnimationEnd

Find examples in Playground
onAnimationEnd: function | null | undefined

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

onAnimationEndObservable

Find examples in Playground
onAnimationEndObservable: Observable<Animatable>

Observer raised when the animation ends

speedRatio

Find examples in Playground
speedRatio: number

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

syncRoot

Find examples in Playground
syncRoot: Animatable

Gets the root Animatable used to synchronize and normalize animations

target

Find examples in Playground
target: any

defines the target object

toFrame

Find examples in Playground
toFrame: number

defines the ending frame number (default is 100)

weight

Find examples in Playground
weight: number

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

Methods

appendAnimations

Find examples in Playground
  • 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

Find examples in Playground
  • disableBlending(): void

enableBlending

Find examples in Playground
  • enableBlending(blendingSpeed: number): void

getAnimationByTargetProperty

Find examples in Playground
  • 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

Find examples in Playground
  • Gets the list of runtime animations

    Returns RuntimeAnimation[]

    an array of RuntimeAnimation

getRuntimeAnimationByTargetProperty

Find examples in Playground
  • 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

Find examples in Playground
  • goToFrame(frame: number): void
  • Jump directly to a given frame

    Parameters

    • frame: number

      defines the frame to jump to

    Returns void

pause

Find examples in Playground
  • pause(): void
  • Pause the animation

    Returns void

reset

Find examples in Playground
  • reset(): void
  • Resets the animatable to its original state

    Returns void

restart

Find examples in Playground
  • restart(): void
  • Restart the animation

    Returns void

stop

Find examples in Playground
  • 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

Find examples in Playground
  • 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

Find examples in Playground
  • Wait asynchronously for the animation to end

    Returns Promise<Animatable>

    a promise which will be fullfilled when the animation ends

Generated using TypeDoc