AnimationClip
ClassAnimation Clip is what an Animation Player uses to manage playback for a specific animation.
- Available on all platforms
Animation Clip is what an Animation Player uses to manage playback for a specific animation. It defines that animation by referencing an Animation Asset and providing start and end points, playback speed and direction, and blending information.
Index
Properties
Methods
Example
//@input Component.AnimationPlayer animationPlayer
//@input Asset.AnimationAsset myAnimation
const myClip = AnimationClip.create("myAnimationClip");
myClip.animation = script.myAnimation;
myClip.begin = 0;
myClip.end = 3.75;
myClip.weight = 1.0;
myClip.playbackSpeed = 0.5;
myClip.playbackMode = PlaybackMode.Loop;
myClip.reversed = true;
myClip.disabled = false;
script.animationPlayer.addClip(myClip);
script.animationPlayer.playClipAt(myClip.name, 0.0);
Extends
Properties
animation
animation:
AnimationAsset
Points to the animation asset to be played by the Animation Player.
Since
Lens Scripting Version 253
Default Value
null
begin
begin:
number
Returns begin time of clip (in seconds).
Since
Lens Scripting Version 253
Default Value
0
blendMode
blendMode:
AnimationLayerBlendMode
The blend mode for this particular clip.
Since
Lens Scripting Version 253
Default Value
AnimationLayerBlendMode.Default
disabled
disabled:
boolean
Whether the animation clip is disabled.
Since
Lens Scripting Version 253
Default Value
false
duration
readonlyduration:number
Returns the duration of the clip which is calculated based on the begin and end times (in seconds).
Since
Lens Scripting Version 253
end
end:
number
Returns end time of clip (in seconds).
Since
Lens Scripting Version 253
Default Value
0
name
readonlyname:string
Name of the clip.
Since
Lens Scripting Version 253
offset
offset:
number
The offset (in seconds) which is the starting point for an animation. After the first iteration, it starts back at the beginning of the clip.
Since
Lens Scripting Version 309
Default Value
0
playbackMode
playbackMode:
PlaybackMode
Choose whether to play animation clip once, loop the clip, or ping pong it.
Since
Lens Scripting Version 253
Default Value
PlaybackMode.Loop
playbackSpeed
playbackSpeed:
number
Scalar value to represent playback speed percentage. 1.0 is 100% playback speed.
Since
Lens Scripting Version 253
Default Value
1
reversed
reversed:
boolean
Specifies if the clip should be played reversed.
Since
Lens Scripting Version 253
Default Value
false
scaleMode
scaleMode:
AnimationLayerScaleMode
How scale is accumulated. Usually does not need to be changed after import.
Since
Lens Scripting Version 253
Default Value
AnimationLayerScaleMode.Multiply
weight
weight:
number
Strength of animation clip contribution. Lies between [0.0, 1.0] inclusive. For default blending a 1.0 weight indicates this clip will override all earlier clips, a less than 1.0 weight indicates it will blend onto the calculated pose using a weighted average.
Since
Lens Scripting Version 253
Default Value
1
Methods
clone()
clone(
clipName):AnimationClip
Clones the existing clip with a new name.
Parameters
| Parameter | Type |
|---|---|
clipName | string |
Returns
AnimationClip
Since
Lens Scripting Version 253
create()
staticcreate(clipName):AnimationClip
Creates a clip.
Parameters
| Parameter | Type |
|---|---|
clipName | string |
Returns
AnimationClip
Since
Lens Scripting Version 253
createFromAnimation()
staticcreateFromAnimation(clipName,animation):AnimationClip
Creates an animation clip from an animation asset.
Parameters
| Parameter | Type |
|---|---|
clipName | string |
animation | AnimationAsset |
Returns
AnimationClip
Since
Lens Scripting Version 265
getTypeName()
staticgetTypeName():TypeName<AnimationClip>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<AnimationClip>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean