Options
All
  • Public
  • Public/Protected
  • All
Menu

Class 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?: Nullable<() => void> | undefined, animations?: Animation[], onAnimationLoop?: Nullable<() => void> | undefined, isAdditive?: boolean): 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: Nullable<() => void> | 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

    • Optional onAnimationLoop: Nullable<() => void> | undefined

      defines a callback to call when animation loops

    • Optional isAdditive: boolean

      defines whether the animation should be evaluated additively

    Returns Animatable

Properties

animationStartedSearch playground for animationStarted

animationStarted: boolean

Gets a boolean indicating if the animation has started

disposeOnEndSearch playground for 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)

fromFrameSearch playground for fromFrame

fromFrame: number

defines the starting frame number (default is 0)

isAdditiveSearch playground for isAdditive

isAdditive: boolean

defines whether the animation should be evaluated additively

loopAnimationSearch playground for loopAnimation

loopAnimation: boolean

defines if the animation must loop (default is false)

Optional onAnimationEndSearch playground for onAnimationEnd

onAnimationEnd: Nullable<() => void> | undefined

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

onAnimationEndObservableSearch playground for onAnimationEndObservable

onAnimationEndObservable: Observable<Animatable>

Observer raised when the animation ends

Optional onAnimationLoopSearch playground for onAnimationLoop

onAnimationLoop: Nullable<() => void> | undefined

defines a callback to call when animation loops

onAnimationLoopObservableSearch playground for onAnimationLoopObservable

onAnimationLoopObservable: Observable<Animatable>

Observer raised when the animation loops

targetSearch playground for target

target: any

defines the target object

toFrameSearch playground for toFrame

toFrame: number

defines the ending frame number (default is 100)

Accessors

masterFrame

  • get masterFrame(): number
  • Gets the current frame of the first RuntimeAnimation Used to synchronize Animatables

    Returns number

speedRatio

  • get speedRatio(): number
  • set speedRatio(value: number): any
  • Gets or sets the speed ratio to apply to the animatable (1.0 by default)

    Returns number

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

    Parameters

    • value: number

    Returns any

syncRoot

  • Gets the root Animatable used to synchronize and normalize animations

    Returns Nullable<Animatable>

weight

  • get weight(): number
  • set weight(value: number): any
  • Gets or sets the animatable weight (-1.0 by default meaning not weighted)

    Returns number

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

    Parameters

    • value: number

    Returns any

Methods

appendAnimationsSearch playground for 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

disableBlendingSearch playground for disableBlending

  • disableBlending(): void

enableBlendingSearch playground for enableBlending

  • enableBlending(blendingSpeed: number): void

getAnimationByTargetPropertySearch playground for getAnimationByTargetProperty

  • Gets the source animation for a specific property

    Parameters

    • property: string

      defines the property to look for

    Returns Nullable<Animation>

    null or the source animation for the given property

getAnimationsSearch playground for getAnimations

  • Gets the list of runtime animations

    Returns RuntimeAnimation[]

    an array of RuntimeAnimation

getRuntimeAnimationByTargetPropertySearch playground for getRuntimeAnimationByTargetProperty

  • Gets the runtime animation for a specific property

    Parameters

    • property: string

      defines the property to look for

    Returns Nullable<RuntimeAnimation>

    null or the runtime animation for the given property

goToFrameSearch playground for goToFrame

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

    Parameters

    • frame: number

      defines the frame to jump to

    Returns void

pauseSearch playground for pause

  • pause(): void
  • Pause the animation

    Returns void

resetSearch playground for reset

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

    Returns void

restartSearch playground for restart

  • restart(): void
  • Restart the animation

    Returns void

stopSearch playground for stop

  • stop(animationName?: string, targetMask?: (target: any) => boolean): 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: (target: any) => boolean

      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

syncWithSearch playground for 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: Nullable<Animatable>

      defines the root Animatable to synchronize with (null to stop synchronizing)

    Returns Animatable

    the current Animatable

waitAsyncSearch playground for waitAsync

  • Wait asynchronously for the animation to end

    Returns Promise<Animatable>

    a promise which will be fulfilled when the animation ends

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method