Options
All
  • Public
  • Public/Protected
  • All
Menu

Use this class to create coordinated animations on multiple targets

Hierarchy

  • AnimationGroup

Implements

Index

Constructors

  • Instantiates a new Animation Group. This helps managing several animations at once.

    see

    https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations

    Parameters

    • name: string

      Defines the name of the group

    • Optional scene: Nullable<Scene>

      Defines the scene the group belongs to

    • Optional weight: number

      Defines the weight to use for animations in the group (-1.0 by default, meaning "no weight")

    • Optional playOrder: number

      Defines the order of play of the animation group (default is 0)

    Returns AnimationGroup

Properties

Gets or sets the mask associated with this animation group. This mask is used to filter which objects should be animated.

metadata: any

Gets or sets an object used to store user defined information for the node

name: string

The name of the animation group

onAnimationEndObservable: Observable<TargetedAnimation>

This observable will notify when one animation have ended

onAnimationGroupEndObservable: Observable<AnimationGroup>

This observable will notify when all animations have ended.

onAnimationGroupLoopObservable: Observable<AnimationGroup>

Observer raised when all animations have looped

onAnimationGroupPauseObservable: Observable<AnimationGroup>

This observable will notify when all animations have paused.

onAnimationGroupPlayObservable: Observable<AnimationGroup>

This observable will notify when all animations are playing.

onAnimationLoopObservable: Observable<TargetedAnimation>

Observer raised when one animation loops

uniqueId: number

Gets or sets the unique id of the node

Accessors

  • returning the list of animatables controlled by this animation group.

    Returns Animatable[]

  • get blendingSpeed(): Nullable<number>
  • set blendingSpeed(value: Nullable<number>): void
  • Gets or sets the animation blending speed Note that a null value means that each animation will use their own existing blending configuration (Animation.blendingSpeed)

    Returns Nullable<number>

  • Gets or sets the animation blending speed Note that a null value means that each animation will use their own existing blending configuration (Animation.blendingSpeed)

    Parameters

    Returns void

  • Gets the list of target animations

    Returns TargetedAnimation[]

  • get enableBlending(): Nullable<boolean>
  • set enableBlending(value: Nullable<boolean>): void
  • Allows the animations of the animation group to blend with current running animations Note that a null value means that each animation will use their own existing blending configuration (Animation.enableBlending)

    Returns Nullable<boolean>

  • Allows the animations of the animation group to blend with current running animations Note that a null value means that each animation will use their own existing blending configuration (Animation.enableBlending)

    Parameters

    Returns void

  • get from(): number
  • Gets the first frame

    Returns number

  • get isAdditive(): boolean
  • set isAdditive(value: boolean): void
  • Gets or sets if all animations should be evaluated additively

    Returns boolean

  • Gets or sets if all animations should be evaluated additively

    Parameters

    • value: boolean

    Returns void

  • get isPlaying(): boolean
  • Gets a value indicating that the current group is playing

    Returns boolean

  • get isStarted(): boolean
  • Define if the animations are started

    Returns boolean

  • get loopAnimation(): boolean
  • set loopAnimation(value: boolean): void
  • Gets or sets if all animations should loop or not

    Returns boolean

  • Gets or sets if all animations should loop or not

    Parameters

    • value: boolean

    Returns void

  • get playOrder(): number
  • set playOrder(value: number): void
  • Gets or sets the order of play of the animation group (default: 0)

    Returns number

  • Gets or sets the order of play of the animation group (default: 0)

    Parameters

    • value: number

    Returns void

  • get speedRatio(): number
  • set speedRatio(value: number): void
  • Gets or sets the speed ratio to use for all animations

    Returns number

  • Gets or sets the speed ratio to use for all animations

    Parameters

    • value: number

    Returns void

  • Gets the targeted animations for this animation group

    Returns TargetedAnimation[]

  • get to(): number
  • Gets the last frame

    Returns number

  • get weight(): number
  • set weight(value: number): void
  • Gets or sets the weight to apply to all animations of the group

    Returns number

  • Gets or sets the weight to apply to all animations of the group

    Parameters

    • value: number

    Returns void

Methods

  • Add an animation (with its target) in the group

    Parameters

    • animation: Animation

      defines the animation we want to add

    • target: any

      defines the target of the animation

    Returns TargetedAnimation

    the TargetedAnimation object

  • clone(newName: string, targetConverter?: ((oldTarget: any) => any), cloneAnimations?: boolean): AnimationGroup
  • Clone the current animation group and returns a copy

    Parameters

    • newName: string

      defines the name of the new group

    • Optional targetConverter: ((oldTarget: any) => any)

      defines an optional function used to convert current animation targets to new ones

        • (oldTarget: any): any
        • Parameters

          • oldTarget: any

          Returns any

    • Optional cloneAnimations: boolean

      defines if the animations should be cloned or referenced

    Returns AnimationGroup

    the new animation group

  • dispose(): void
  • Dispose all associated resources

    Returns void

  • getClassName(): string
  • Returns the string "AnimationGroup"

    Returns string

    "AnimationGroup"

  • getLength(from?: number, to?: number): number
  • Gets the length (in seconds) of the animation group This function assumes that all animations are played at the same framePerSecond speed! Note: you can only call this method after you've added at least one targeted animation!

    Parameters

    • Optional from: number

      Starting frame range (default is AnimationGroup.from)

    • Optional to: number

      Ending frame range (default is AnimationGroup.to)

    Returns number

    The length in seconds

  • Goes to a specific frame in this animation group

    Parameters

    • frame: number

      the frame number to go to

    Returns AnimationGroup

    the animationGroup

  • This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame It can add constant keys at begin or end

    Parameters

    • Optional beginFrame: Nullable<number>

      defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)

    • Optional endFrame: Nullable<number>

      defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)

    Returns AnimationGroup

    the animation group

  • Pause all animations

    Returns AnimationGroup

    the animation group

  • Play all animations to initial state This function will start() the animations if they were not started or will restart() them if they were paused

    Parameters

    • Optional loop: boolean

      defines if animations must loop

    Returns AnimationGroup

    the animation group

  • removeTargetedAnimation(animation: Animation): void
  • Remove an animation from the group

    Parameters

    • animation: Animation

      defines the animation we want to remove

    Returns void

  • removeUnmaskedAnimations(): void
  • Removes all animations for the targets not retained by the animation group mask. Use this function if you know you won't need those animations anymore and if you want to free memory.

    Returns void

  • Reset all animations to initial state

    Returns AnimationGroup

    the animation group

  • Restart animations from key 0

    Returns AnimationGroup

    the animation group

  • serialize(): any
  • Serializes the animationGroup to an object

    Returns any

    Serialized object

  • start(loop?: boolean, speedRatio?: number, from?: number, to?: number, isAdditive?: boolean): AnimationGroup
  • Start all animations on given targets

    Parameters

    • Optional loop: boolean

      defines if animations must loop

    • Optional speedRatio: number

      defines the ratio to apply to animation speed (1 by default)

    • Optional from: number

      defines the from key (optional)

    • Optional to: number

      defines the to key (optional)

    • Optional isAdditive: boolean

      defines the additive state for the resulting animatables (optional)

    Returns AnimationGroup

    the current animation group

  • Stop all animations

    Returns AnimationGroup

    the animation group

  • syncWithMask(): void
  • Makes sure that the animations are either played or stopped according to the animation group mask. Note however that the call won't have any effect if the animation group has not been started yet. You should call this function if you modify the mask after the animation group has been started.

    Returns void

  • toString(fullDetails?: boolean): string
  • Creates a detailed string about the object

    Parameters

    • Optional fullDetails: boolean

      defines if the output string will support multiple levels of logging within scene loading

    Returns string

    a string representing the object

  • ClipFrames(sourceAnimationGroup: AnimationGroup, fromFrame: number, toFrame: number, name?: string, dontCloneAnimations?: boolean): AnimationGroup
  • Creates a new animation, keeping only the frames that are inside a given frame range

    Parameters

    • sourceAnimationGroup: AnimationGroup

      defines the animation group on which to operate

    • fromFrame: number

      defines the lower bound of the range

    • toFrame: number

      defines the upper bound of the range

    • Optional name: string

      defines the name of the new animation group. If not provided, use the same name as animationGroup

    • Optional dontCloneAnimations: boolean

      defines whether or not the animations should be cloned before clipping the frames. Default is false, so animations will be cloned

    Returns AnimationGroup

    a new animation group stripped from all the frames outside the given range

  • Updates an existing animation, keeping only the frames that are inside a given frame range

    Parameters

    • animationGroup: AnimationGroup

      defines the animation group on which to operate

    • fromFrame: number

      defines the lower bound of the range

    • toFrame: number

      defines the upper bound of the range

    • Optional dontCloneAnimations: boolean

      defines whether or not the animations should be cloned before clipping the frames. Default is false, so animations will be cloned

    Returns AnimationGroup

    the animationGroup stripped from all the frames outside the given range

  • Updates an existing animation, keeping only the keys that are inside a given key or frame range

    Parameters

    • animationGroup: AnimationGroup

      defines the animation group on which to operate

    • start: number

      defines the lower bound of the range

    • end: number

      defines the upper bound of the range

    • Optional dontCloneAnimations: boolean

      defines whether or not the animations should be cloned before clipping the keys. Default is false, so animations will be cloned

    • Optional useFrame: boolean

      defines if the range is defined by frame numbers or key indices (default is false which means use key indices)

    Returns AnimationGroup

    the animationGroup stripped from all the keys outside the given range

  • ClipKeys(sourceAnimationGroup: AnimationGroup, fromKey: number, toKey: number, name?: string, dontCloneAnimations?: boolean): AnimationGroup
  • Creates a new animation, keeping only the keys that are inside a given key range

    Parameters

    • sourceAnimationGroup: AnimationGroup

      defines the animation group on which to operate

    • fromKey: number

      defines the lower bound of the range

    • toKey: number

      defines the upper bound of the range

    • Optional name: string

      defines the name of the new animation group. If not provided, use the same name as animationGroup

    • Optional dontCloneAnimations: boolean

      defines whether or not the animations should be cloned before clipping the keys. Default is false, so animations will be cloned

    Returns AnimationGroup

    a new animation group stripped from all the keys outside the given range

  • Updates an existing animation, keeping only the keys that are inside a given key range

    Parameters

    • animationGroup: AnimationGroup

      defines the animation group on which to operate

    • fromKey: number

      defines the lower bound of the range

    • toKey: number

      defines the upper bound of the range

    • Optional dontCloneAnimations: boolean

      defines whether or not the animations should be cloned before clipping the keys. Default is false, so animations will be cloned

    Returns AnimationGroup

    the animationGroup stripped from all the keys outside the given range

  • Convert the keyframes for all animations belonging to the group to be relative to a given reference frame.

    Parameters

    • sourceAnimationGroup: AnimationGroup

      defines the AnimationGroup containing animations to convert

    • 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 animations in the group to convert

    • Optional cloneOriginal: boolean

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

    • Optional clonedName: string

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

    Returns AnimationGroup

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

  • Convert the keyframes for all animations belonging to the group to be relative to a given reference frame.

    Parameters

    Returns AnimationGroup

    a new AnimationGroup if options.cloneOriginalAnimationGroup is true or the original AnimationGroup if options.cloneOriginalAnimationGroup is false

  • Merge the array of animation groups into a new animation group

    Parameters

    • animationGroups: AnimationGroup[]

      List of animation groups to merge

    • Optional disposeSource: boolean

      If true, animation groups will be disposed after being merged (default: true)

    • Optional normalize: boolean

      If true, animation groups will be normalized before being merged, so that all animations have the same "from" and "to" frame (default: false)

    • Optional weight: number

      Weight for the new animation group. If not provided, it will inherit the weight from the first animation group of the array

    Returns Nullable<AnimationGroup>

    The new animation group or null if no animation groups were passed

  • Returns a new AnimationGroup object parsed from the source provided.

    Parameters

    • parsedAnimationGroup: any

      defines the source

    • scene: Scene

      defines the scene that will receive the animationGroup

    Returns AnimationGroup

    a new AnimationGroup

Legend

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

Settings

Theme