Class Animatable
Constructors
constructor
-
new Animatable(
scene: Scene,
target: any,
fromFrame?: number,
toFrame?: number,
loopAnimation?: boolean,
speedRatio?: number,
onAnimationEnd?: any,
animations?: Animation[],
onAnimationLoop?: any,
isAdditive?: boolean,
playOrder?: number,
): AnimatableCreates a new Animatable
Parameters
- scene: Scene
defines the hosting scene
- target: any
defines the target object
- fromFrame: number = 0
defines the starting frame number (default is 0)
- toFrame: number = 100
defines the ending frame number (default is 100)
- loopAnimation: boolean = false
defines if the animation must loop (default is false)
- speedRatio: number = 1.0
defines the factor to apply to animation speed (default is 1)
OptionalonAnimationEnd: anydefines a callback to call when animation ends if it is not looping
Optionalanimations: Animation[]defines a group of animation to add to the new Animatable
OptionalonAnimationLoop: anydefines a callback to call when animation loops
- isAdditive: boolean = false
defines whether the animation should be evaluated additively
- playOrder: number = 0
defines the order in which this animatable should be processed in the list of active animatables (default: 0)
Returns Animatable
- scene: Scene
Properties
animation Started
Gets a boolean indicating if the animation has started
dispose On End
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)
from Frame
[0] defines the starting frame number (default is 0)
is Additive
[false] defines whether the animation should be evaluated additively
loop Animation
[false] defines if the animation must loop (default is false)
Optionalon Animation End
defines a callback to call when animation ends if it is not looping
on Animation End Observable
Observer raised when the animation ends
Optionalon Animation Loop
defines a callback to call when animation loops
on Animation Loop Observable
Observer raised when the animation loops
play Order
[0] defines the order in which this animatable should be processed in the list of active animatables (default: 0)
target
defines the target object
to Frame
[100] defines the ending frame number (default is 100)
StaticProcess Paused Animatables
If true, the animatable will be processed even if it is considered actively paused (weight of 0 and previous weight of 0). This can be used to force the full processing of paused animatables in the animation engine. Default is false.
Accessors
elapsed Time
-
get elapsedTime(): number
Gets the elapsed time since the animatable started in milliseconds
Returns number
master Frame
-
get masterFrame(): number
Gets the current frame of the first RuntimeAnimation Used to synchronize Animatables
Returns number
paused
-
get paused(): boolean
Returns true if the animations for this animatable are paused
Returns boolean
speed Ratio
-
get speedRatio(): number
Gets or sets the speed ratio to apply to the animatable (1.0 by default)
Returns number
-
set speedRatio(value: number): void
Parameters
- value: number
Returns void
sync Root
-
Gets the root Animatable used to synchronize and normalize animations
Returns Nullable<Animatable>
weight
-
get weight(): number
Gets or sets the animatable weight (-1.0 by default meaning not weighted)
Returns number
-
set weight(value: number): void
Parameters
- value: number
Returns void
Methods
append Animations
-
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
- target: any
disable Blending
-
Disable animation blending
Returns void
enable Blending
-
Allows the animatable to blend with current running animations
Parameters
- blendingSpeed: number
defines the blending speed to use
Returns void
- blendingSpeed: number
get Animation By Target Property
-
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
- property: string
get Animations
get Runtime Animation By Target Property
-
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
- property: string
go To Frame
-
Jump directly to a given frame
Parameters
- frame: number
defines the frame to jump to
- useWeight: boolean = false
defines whether the animation weight should be applied to the image to be jumped to (false by default)
Returns void
- frame: number
pause
-
Pause the animation
Returns void
reset
-
Resets the animatable to its original state
Returns void
restart
-
Restart the animation
Returns void
stop
-
stop(
animationName?: string,
targetMask?: (target: any) => boolean,
useGlobalSplice?: boolean,
skipOnAnimationEnd?: boolean,
): voidStop and delete the current animation
Parameters
OptionalanimationName: stringdefines a string used to only stop some of the runtime animations instead of all
OptionaltargetMask: (target: any) => booleana 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)
- useGlobalSplice: boolean = false
if true, the animatables will be removed by the caller of this function (false by default)
- skipOnAnimationEnd: boolean = false
defines if the system should not raise onAnimationEnd. Default is false
Returns void
sync With
-
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
- root: Nullable<Animatable>
wait Async
-
Wait asynchronously for the animation to end
Returns Promise<Animatable>
a promise which will be fulfilled when the animation ends
Class used to store an actual running animation