Class AnimationGroup
Implements
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
new AnimationGroup(
name: string,
scene?: Nullable<Scene>,
weight?: number,
playOrder?: number,
): AnimationGroupInstantiates a new Animation Group. This helps managing several animations at once.
Parameters
- name: string
Defines the name of the group
- scene: Nullable<Scene> = null
Defines the scene the group belongs to
- weight: number = -1
Defines the weight to use for animations in the group (-1.0 by default, meaning "no weight")
- playOrder: number = 0
Defines the order of play of the animation group (default is 0)
Returns AnimationGroup
- name: string
Properties
metadata
Gets or sets an object used to store user defined information for the node
name
The name of the animation group
on Animation End Observable
This observable will notify when one animation have ended
on Animation Group End Observable
This observable will notify when all animations have ended.
on Animation Group Loop Observable
Observer raised when all animations have looped
on Animation Group Pause Observable
This observable will notify when all animations have paused.
on Animation Group Play Observable
This observable will notify when all animations are playing.
on Animation Loop Observable
Observer raised when one animation loops
unique Id
Gets or sets the unique id of the node
Accessors
animatables
-
returning the list of animatables controlled by this animation group.
Returns Animatable[]
blending Speed
children
-
Gets the list of target animations
Returns TargetedAnimation[]
enable Blending
from
-
get from(): number
Gets or sets the first frame
Returns number
-
set from(value: number): void
Parameters
- value: number
Returns void
is Additive
-
get isAdditive(): boolean
Gets or sets if all animations should be evaluated additively
Returns boolean
-
set isAdditive(value: boolean): void
Parameters
- value: boolean
Returns void
is Playing
-
get isPlaying(): boolean
Gets a value indicating that the current group is playing
Returns boolean
is Started
-
get isStarted(): boolean
Define if the animations are started
Returns boolean
loop Animation
-
get loopAnimation(): boolean
Gets or sets if all animations should loop or not
Returns boolean
-
set loopAnimation(value: boolean): void
Parameters
- value: boolean
Returns void
mask
-
Gets or sets the mask associated with this animation group. This mask is used to filter which objects should be animated.
Returns Nullable<AnimationGroupMask>
-
Parameters
- value: Nullable<AnimationGroupMask>
Returns void
play Order
-
get playOrder(): number
Gets or sets the order of play of the animation group (default: 0)
Returns number
-
set playOrder(value: number): void
Parameters
- value: number
Returns void
speed Ratio
-
get speedRatio(): number
Gets or sets the speed ratio to use for all animations
Returns number
-
set speedRatio(value: number): void
Gets or sets the speed ratio to use for all animations
Parameters
- value: number
Returns void
targeted Animations
-
Gets the targeted animations for this animation group
Returns TargetedAnimation[]
to
-
get to(): number
Gets or sets the last frame
Returns number
-
set to(value: number): void
Parameters
- value: number
Returns void
weight
-
get weight(): number
Gets or sets the weight to apply to all animations of the group
Returns number
-
set weight(value: number): void
Parameters
- value: number
Returns void
Methods
add Targeted Animation
-
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
- animation: Animation
clone
-
clone(
newName: string,
targetConverter?: (oldTarget: any) => any,
cloneAnimations?: boolean,
cloneAnimationKeys?: boolean,
): AnimationGroupClone the current animation group and returns a copy
Parameters
- newName: string
defines the name of the new group
OptionaltargetConverter: (oldTarget: any) => anydefines an optional function used to convert current animation targets to new ones
- cloneAnimations: boolean = false
defines if the animations should be cloned or referenced
- cloneAnimationKeys: boolean = false
defines if the animation keys should be cloned when cloning animations (false by default). No effect if cloneAnimations is false
Returns AnimationGroup
the new animation group
- newName: string
dispose
-
Dispose all associated resources
Returns void
get Class Name
-
Returns the string "AnimationGroup"
Returns string
"AnimationGroup"
get Current Frame
-
Helper to get the current frame. This returns 0 when the AnimationGroup is not running and might be inaccurate when animations use different frames.
Returns number
current animation frame.
get Length
-
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
Optionalfrom: numberStarting frame range (default is AnimationGroup.from)
Optionalto: numberEnding frame range (default is AnimationGroup.to)
Returns number
The length in seconds
get Retained Current Frame
-
Gets the last effective frame, retaining it after the group stops.
Returns number
current or retained effective animation frame
get Scene
get Virtual Current Frame
-
Gets the current frame on the unbounded timeline requested by the caller. Unlike getCurrentFrame, this value is not clamped or wrapped by the animation's keyframe range and is retained after the group stops.
Returns number
the current virtual animation frame
go To Frame
-
Goes to a specific frame in this animation group. Note that the animation group must be in playing or paused status
Parameters
- frame: number
the frame number to go to
- useWeight: boolean = false
defines whether the animation weight should be applied to the image to be jumped to (false by default)
Returns AnimationGroup
the animationGroup
- frame: number
is Valid Virtual Stop Frame
-
Returns whether a frame is inside the requested start/end interval. The end frame is excluded because natural completion takes precedence.
Parameters
- frame: number
virtual frame to test
Returns boolean
true when a scheduled stop may occur at the frame
- frame: number
is Virtual Frame Reached
-
Returns whether the virtual timeline crossed the requested frame.
Parameters
- frame: number
virtual frame to test
Returns boolean
true when the frame was reached in the playback direction
- frame: number
normalize
-
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
- beginFrame: Nullable<number> = null
defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)
- endFrame: Nullable<number> = null
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
- beginFrame: Nullable<number> = null
pause
play
-
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
Optionalloop: booleandefines if animations must loop
Returns AnimationGroup
the animation group
remove Targeted Animation
-
Remove an animation from the group
Parameters
- animation: Animation
defines the animation we want to remove
Returns void
- animation: Animation
remove Unmasked Animations
-
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
restart
serialize
-
Serializes the animationGroup to an object
Returns any
Serialized object
set Virtual Current Frame
-
Snaps both retained playheads to an exact virtual timeline position.
Parameters
- frame: number
virtual frame to retain
Returns void
- frame: number
set Weight For All Animatables
-
SinceSet animation weight for all animatables
6.12.4 You can pass the weight to the AnimationGroup constructor, or use the weight property to set it after the group has been created, making it easier to define the overall animation weight than calling setWeightForAllAnimatables() after the animation group has been started
Parameters
- weight: number
defines the weight to use
Returns AnimationGroup
the animationGroup
- weight: number
start
-
start(
loop?: boolean,
speedRatio?: number,
from?: number,
to?: number,
isAdditive?: boolean,
): AnimationGroupStart all animations on given targets
Parameters
- loop: boolean = false
defines if animations must loop
- speedRatio: number = 1
defines the ratio to apply to animation speed (1 by default)
Optionalfrom: numberdefines the from key (optional)
Optionalto: numberdefines the to key (optional)
OptionalisAdditive: booleandefines the additive state for the resulting animatables (optional)
Returns AnimationGroup
the current animation group
- loop: boolean = false
start With Virtual Timeline
-
startWithVirtualTimeline(
loop?: boolean,
speedRatio?: number,
from?: number,
to?: number,
isAdditive?: boolean,
): AnimationGroupStarts all animations using an unbounded requested timeline mapped to the animation's effective keyframe range.
Parameters
- loop: boolean = false
defines if animations must loop
- speedRatio: number = 1
defines the ratio to apply to animation speed
Optionalfrom: numberdefines the requested start frame
Optionalto: numberdefines the requested end frame
OptionalisAdditive: booleandefines the additive state for the resulting animatables
Returns AnimationGroup
the current animation group
- loop: boolean = false
stop
-
Stop all animations
Parameters
- skipOnAnimationEnd: boolean = false
defines if the system should not raise onAnimationEnd. Default is false
Returns AnimationGroup
the animation group
- skipOnAnimationEnd: boolean = false
sync All Animations With
-
Synchronize and normalize all animatables with a source animatable
Parameters
- root: Nullable<Animatable>
defines the root animatable to synchronize with (null to stop synchronizing)
Returns AnimationGroup
the animationGroup
- root: Nullable<Animatable>
sync With Mask
-
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.
Parameters
- forceUpdate: boolean = false
If true, forces to loop over the animatables even if no mask is defined (used internally, you shouldn't need to use it). Default: false.
Returns void
- forceUpdate: boolean = false
to String
-
Creates a detailed string about the object
Parameters
OptionalfullDetails: booleandefines if the output string will support multiple levels of logging within scene loading
Returns string
a string representing the object
Use this class to create coordinated animations on multiple targets