Class used to store any kind of animation

Hierarchy

  • BabylonAnimation

Constructors

  • Initializes the animation

    Parameters

    • name: string

      Name of the animation

    • targetProperty: string

      Property to animate

    • framePerSecond: number

      The frames per second of the animation

    • dataType: number

      The data type of the animation

    • Optional loopMode: number

      The loop mode of the animation

    • Optional enableBlending: boolean

      Specifies if blending should be enabled

    Returns BabylonAnimation

Properties

blendingSpeed: number

Stores the blending speed of the animation

dataType: number

The data type of the animation

enableBlending?: boolean

Specifies if blending should be enabled

framePerSecond: number

The frames per second of the animation

loopMode?: number

The loop mode of the animation

name: string

Name of the animation

snippetId: string

Snippet ID if the animation was created from the snippet server

targetProperty: string

Property to animate

targetPropertyPath: string[]

Stores an array of target property paths

uniqueId: number

Gets or sets the unique id of the animation (the uniqueness is solely among other animations)

ANIMATIONLOOPMODE_CONSTANT: 2 = 2

Constant Loop Mode

ANIMATIONLOOPMODE_CYCLE: 1 = 1

Cycle Loop Mode

ANIMATIONLOOPMODE_RELATIVE: 0 = 0

Relative Loop Mode

ANIMATIONLOOPMODE_YOYO: 4 = 4

Yoyo Loop Mode

ANIMATIONTYPE_COLOR3: 4 = 4

Color3 animation type

ANIMATIONTYPE_COLOR4: 7 = 7

Color3 animation type

ANIMATIONTYPE_FLOAT: 0 = 0

Float animation type

ANIMATIONTYPE_MATRIX: 3 = 3

Matrix animation type

ANIMATIONTYPE_QUATERNION: 2 = 2

Quaternion animation type

ANIMATIONTYPE_SIZE: 6 = 6

Size animation type

ANIMATIONTYPE_VECTOR2: 5 = 5

Vector2 animation type

ANIMATIONTYPE_VECTOR3: 1 = 1

Vector3 animation type

AllowMatricesInterpolation: boolean

Use matrix interpolation instead of using direct key value when animating matrices

AllowMatrixDecomposeForInterpolation: boolean

When matrix interpolation is enabled, this boolean forces the system to use Matrix.DecomposeLerp instead of Matrix.Lerp. Interpolation is more precise but slower

CreateFromSnippetAsync: ((snippetId: string) => Promise<BabylonAnimation | BabylonAnimation[]>)

Type declaration

    • (snippetId: string): Promise<BabylonAnimation | BabylonAnimation[]>
    • Creates an animation or an array of animations from a snippet saved by the Inspector

      Returns

      a promise that will resolve to the new animation or a new array of animations

      Parameters

      • snippetId: string

        defines the snippet to load

      Returns Promise<BabylonAnimation | BabylonAnimation[]>

SnippetUrl: string

Define the Url to load snippets

Accessors

  • get hasRunningRuntimeAnimations(): boolean
  • Specifies if any of the runtime animations are currently running

    Returns boolean

  • get runtimeAnimations(): RuntimeAnimation[]
  • Return the array of runtime animations currently using this animation

    Returns RuntimeAnimation[]

Methods

  • Add an event to this animation

    Parameters

    • event: AnimationEvent

      Event to add

    Returns void

  • Makes a copy of the animation

    Returns

    Cloned animation

    Returns BabylonAnimation

  • Interpolates a Color3 linearly

    Returns

    Interpolated Color3 value

    Parameters

    • startValue: Color3

      Start value of the animation curve

    • endValue: Color3

      End value of the animation curve

    • gradient: number

      Scalar amount to interpolate

    Returns Color3

  • Interpolates a Color3 cubically

    Returns

    interpolated value

    Parameters

    • startValue: Color3

      Start value of the animation curve

    • outTangent: Color3

      End tangent of the animation

    • endValue: Color3

      End value of the animation curve

    • inTangent: Color3

      Start tangent of the animation curve

    • gradient: number

      Scalar amount to interpolate

    Returns Color3

  • Interpolates a Color4 linearly

    Returns

    Interpolated Color3 value

    Parameters

    • startValue: Color4

      Start value of the animation curve

    • endValue: Color4

      End value of the animation curve

    • gradient: number

      Scalar amount to interpolate

    Returns Color4

  • Interpolates a Color4 cubically

    Returns

    interpolated value

    Parameters

    • startValue: Color4

      Start value of the animation curve

    • outTangent: Color4

      End tangent of the animation

    • endValue: Color4

      End value of the animation curve

    • inTangent: Color4

      Start tangent of the animation curve

    • gradient: number

      Scalar amount to interpolate

    Returns Color4

  • Creates a key for the frame passed as a parameter and adds it to the animation IF a key doesn't already exist for that frame

    Returns

    The key index if the key was added or the index of the pre existing key if the frame passed as parameter already has a corresponding key

    Parameters

    • frame: number

      Frame number

    Returns number

  • Creates an animation range

    Parameters

    • name: string

      Name of the animation range

    • from: number

      Starting frame of the animation range

    • to: number

      Ending frame of the animation

    Returns void

  • Deletes an animation range by name

    Parameters

    • name: string

      Name of the animation range to delete

    • Optional deleteFrames: boolean

      Specifies if the key frames for the range should also be deleted (true) or not (false)

    Returns void

  • Evaluate the animation value at a given frame

    Returns

    the animation value

    Parameters

    • currentFrame: number

      defines the frame where we want to evaluate the animation

    Returns any

  • Interpolates a scalar linearly

    Returns

    Interpolated scalar value

    Parameters

    • startValue: number

      Start value of the animation curve

    • endValue: number

      End value of the animation curve

    • gradient: number

      Scalar amount to interpolate

    Returns number

  • Interpolates a scalar cubically

    Returns

    Interpolated scalar value

    Parameters

    • startValue: number

      Start value of the animation curve

    • outTangent: number

      End tangent of the animation

    • endValue: number

      End value of the animation curve

    • inTangent: number

      Start tangent of the animation curve

    • gradient: number

      Scalar amount to interpolate

    Returns number

  • Gets the easing function of the animation

    Returns

    Easing function of the animation

    Returns Nullable<IEasingFunction>

  • Retrieves all the events from the animation

    Returns

    Events from the animation

    Returns AnimationEvent[]

  • Gets the highest frame rate of the animation

    Returns

    Highest frame rate of the animation

    Returns number

  • Gets the key frames from the animation

    Returns

    The key frames of the animation

    Returns IAnimationKey[]

  • Gets the animation range by name, or null if not defined

    Returns

    Nullable animation range

    Parameters

    • name: string

      Name of the animation range

    Returns Nullable<AnimationRange>

  • Defines the function to use to interpolate matrices

    Returns

    the interpolated matrix

    Parameters

    • startValue: Matrix

      defines the start matrix

    • endValue: Matrix

      defines the end matrix

    • gradient: number

      defines the gradient between both matrices

    • Optional result: Matrix

      defines an optional target matrix where to store the interpolation

    Returns Matrix

  • Interpolates a quaternion using a spherical linear interpolation

    Returns

    Interpolated quaternion value

    Parameters

    • startValue: Quaternion

      Start value of the animation curve

    • endValue: Quaternion

      End value of the animation curve

    • gradient: number

      Scalar amount to interpolate

    Returns Quaternion

  • Interpolates a quaternion cubically

    Returns

    Interpolated quaternion value

    Parameters

    • startValue: Quaternion

      Start value of the animation curve

    • outTangent: Quaternion

      End tangent of the animation curve

    • endValue: Quaternion

      End value of the animation curve

    • inTangent: Quaternion

      Start tangent of the animation curve

    • gradient: number

      Scalar amount to interpolate

    Returns Quaternion

  • Remove all events found at the given frame

    Parameters

    • frame: number

      The frame to remove events from

    Returns void

  • Serializes the animation to an object

    Returns

    Serialized object

    Returns any

  • Sets the easing function of the animation

    Parameters

    • easingFunction: Nullable<IEasingFunction>

      A custom mathematical formula for animation

    Returns void

  • Sets the key frames of the animation

    Parameters

    • values: IAnimationKey[]

      The animation key frames to set

    • Optional dontClone: boolean

      Whether to clone the keys or not (default is false, so the array of keys is cloned)

    Returns void

  • Interpolates a size linearly

    Returns

    Interpolated Size value

    Parameters

    • startValue: Size

      Start value of the animation curve

    • endValue: Size

      End value of the animation curve

    • gradient: number

      Scalar amount to interpolate

    Returns Size

  • Converts the animation to a string

    Returns

    String form of the animation

    Parameters

    • Optional fullDetails: boolean

      support for multiple levels of logging within scene loading

    Returns string

  • Interpolates a Vector2 linearly

    Returns

    Interpolated Vector2 value

    Parameters

    • startValue: Vector2

      Start value of the animation curve

    • endValue: Vector2

      End value of the animation curve

    • gradient: number

      Scalar amount to interpolate (value between 0 and 1)

    Returns Vector2

  • Interpolates a Vector2 cubically

    Returns

    Interpolated Vector2 value

    Parameters

    • startValue: Vector2

      Start value of the animation curve

    • outTangent: Vector2

      End tangent of the animation

    • endValue: Vector2

      End value of the animation curve

    • inTangent: Vector2

      Start tangent of the animation curve

    • gradient: number

      Scalar amount to interpolate (value between 0 and 1)

    Returns Vector2

  • Interpolates a Vector3 linearly

    Returns

    Interpolated scalar value

    Parameters

    • startValue: Vector3

      Start value of the animation curve

    • endValue: Vector3

      End value of the animation curve

    • gradient: number

      Scalar amount to interpolate (value between 0 and 1)

    Returns Vector3

  • Interpolates a Vector3 cubically

    Returns

    InterpolatedVector3 value

    Parameters

    • startValue: Vector3

      Start value of the animation curve

    • outTangent: Vector3

      End tangent of the animation

    • endValue: Vector3

      End value of the animation curve

    • inTangent: Vector3

      Start tangent of the animation curve

    • gradient: number

      Scalar amount to interpolate (value between 0 and 1)

    Returns Vector3

  • Appends the serialized animations from the source animations

    Parameters

    • source: IAnimatable

      Source containing the animations

    • destination: any

      Target to store the animations

    Returns void

  • Create and start an animation on a node

    Returns

    the animatable created for this animation

    Parameters

    • name: string

      defines the name of the global animation that will be run on all nodes

    • target: any

      defines the target where the animation will take place

    • targetProperty: string

      defines property to animate

    • framePerSecond: number

      defines the number of frame per second yo use

    • totalFrame: number

      defines the number of frames in total

    • from: any

      defines the initial value

    • to: any

      defines the final value

    • Optional loopMode: number

      defines which loop mode you want to use (off by default)

    • Optional easingFunction: EasingFunction

      defines the easing function to use (linear by default)

    • Optional onAnimationEnd: (() => void)

      defines the callback to call when animation end

        • (): void
        • Returns void

    • Optional scene: Scene

      defines the hosting scene

    Returns Nullable<Animatable>

  • Create and start an animation on a node and its descendants

    Returns

    the list of animatables created for all nodes

    Example

    https://www.babylonjs-playground.com/#MH0VLI
    

    Parameters

    • name: string

      defines the name of the global animation that will be run on all nodes

    • node: Node

      defines the root node where the animation will take place

    • directDescendantsOnly: boolean

      if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used

    • targetProperty: string

      defines property to animate

    • framePerSecond: number

      defines the number of frame per second to use

    • totalFrame: number

      defines the number of frames in total

    • from: any

      defines the initial value

    • to: any

      defines the final value

    • Optional loopMode: number

      defines which loop mode you want to use (off by default)

    • Optional easingFunction: EasingFunction

      defines the easing function to use (linear by default)

    • Optional onAnimationEnd: (() => void)

      defines the callback to call when an animation ends (will be called once per node)

        • (): void
        • Returns void

    Returns Nullable<Animatable[]>

  • Sets up an animation

    Returns

    The created animation

    Parameters

    • property: string

      The property to animate

    • animationType: number

      The animation type to apply

    • framePerSecond: number

      The frames per second of the animation

    • easingFunction: EasingFunction

      The easing function used in the animation

    Returns BabylonAnimation

  • Creates a new animation, merges it with the existing animations and starts it

    Returns

    Nullable animation

    Parameters

    • name: string

      Name of the animation

    • node: Node

      Node which contains the scene that begins the animations

    • targetProperty: string

      Specifies which property to animate

    • framePerSecond: number

      The frames per second of the animation

    • totalFrame: number

      The total number of frames

    • from: any

      The frame at the beginning of the animation

    • to: any

      The frame at the end of the animation

    • Optional loopMode: number

      Specifies the loop mode of the animation

    • Optional easingFunction: EasingFunction

      (Optional) The easing function of the animation, which allow custom mathematical formulas for animations

    • Optional onAnimationEnd: (() => void)

      Callback to run once the animation is complete

        • (): void
        • Returns void

    Returns Nullable<Animatable>

  • Convert the keyframes of an animation to be relative to a given reference frame.

    Returns

    a new Animation if cloneOriginal is true or the original Animation if cloneOriginal is false

    Parameters

    • sourceAnimation: BabylonAnimation

      defines the Animation containing keyframes to convert

    • Optional referenceFrame: number

      defines the frame that keyframes in the range will be relative to (default: 0)

    • Optional range: string

      defines the name of the AnimationRange belonging to the Animation to convert

    • Optional cloneOriginal: boolean

      defines whether or not to clone the animation and convert the clone or convert the original animation (default is false)

    • Optional clonedName: string

      defines the name of the resulting cloned Animation if cloneOriginal is true

    Returns BabylonAnimation

  • Convert the keyframes of an animation to be relative to a given reference frame.

    Returns

    a new Animation if options.cloneOriginalAnimation is true or the original Animation if options.cloneOriginalAnimation is false

    Parameters

    • sourceAnimation: BabylonAnimation

      defines the Animation containing keyframes to convert

    • Optional options: IMakeAnimationAdditiveOptions

      defines the options to use when converting ey keyframes

    Returns BabylonAnimation

  • Parses an animation object and creates an animation

    Returns

    Animation object

    Parameters

    • parsedAnimation: any

      Parsed animation object

    Returns BabylonAnimation

  • Creates a new animation or an array of animations from a snippet saved in a remote file

    Returns

    a promise that will resolve to the new animation or an array of animations

    Parameters

    • name: Nullable<string>

      defines the name of the animation to create (can be null or empty to use the one from the json data)

    • url: string

      defines the url to load from

    Returns Promise<BabylonAnimation | BabylonAnimation[]>

  • Creates an animation or an array of animations from a snippet saved by the Inspector

    Returns

    a promise that will resolve to the new animation or a new array of animations

    Parameters

    • snippetId: string

      defines the snippet to load

    Returns Promise<BabylonAnimation | BabylonAnimation[]>

  • Transition property of an host to the target Value

    Returns

    Nullable animation

    Parameters

    • property: string

      The property to transition

    • targetValue: any

      The target Value of the property

    • host: any

      The object where the property to animate belongs

    • scene: Scene

      Scene used to run the animation

    • frameRate: number

      Framerate (in frame/s) to use

    • transition: BabylonAnimation

      The transition type we want to use

    • duration: number

      The duration of the animation, in milliseconds

    • Optional onAnimationEnd: Nullable<(() => void)>

      Callback trigger at the end of the animation

    Returns Nullable<Animatable>

Generated using TypeDoc