AnimationAsset
ClassRepresents animation data.
- Available on all platforms
Since Lens Scripting v253
Represents animation data. Can have multiple AnimationPropertyLayers. Used in AnimationClip.
Index
Properties
Methods
Remarks
AnimationAssets themselves do not handle playing or orchestrating animations. This is left to the AnimationPlayer component to handle.
Example
// @input Asset.AnimationAsset animAsset
const startEventName = 'animStarted';
const startTimestamp = 0;
const e = script.animAsset.createEvent(startEventName, startTimestamp);
const endEventName = 'animEnded';
const endTimestamp = script.animAsset.duration;
script.animAsset.createEvent(endEventName, endTimestamp);
Extends
Properties
duration
readonlyduration:number
Animation duration in seconds.
Since
Lens Scripting Version 253
fps
readonlyfps:number
Denotes how many key frames this animation was sampled at.
Since
Lens Scripting Version 253
name
name:
string
The name of the Asset in Lens Studio.
Default Value
""
Inherited from
uniqueIdentifier
readonlyuniqueIdentifier:string
Since
Lens Scripting Version 176
Inherited from
Methods
addLayer()
addLayer(
layerName,layer):void
Adds AnimationPropertyLayer to Animation asset.
Parameters
| Parameter | Type |
|---|---|
layerName | string |
layer | AnimationPropertyLayer |
Returns
void
Since
Lens Scripting Version 253
clearLayers()
clearLayers():
void
Delete all the AnimationPropertyLayer in this AnimationAsset.
Returns
void
Since
Lens Scripting Version 253
create()
staticcreate():AnimationAsset
Create new animation asset.
Returns
AnimationAsset
Since
Lens Scripting Version 333
createEvent()
createEvent(
eventName,time):AnimationPropertyEventRegistration
Creates an event that will be triggered at a given time of this animation asset.
Parameters
| Parameter | Type |
|---|---|
eventName | string |
time | number |
Returns
AnimationPropertyEventRegistration
Since
Lens Scripting Version 265
deleteEvent()
deleteEvent(
registration?):void
Deletes an event that will be triggered at a given time.
Parameters
| Parameter | Type |
|---|---|
registration? | AnimationPropertyEventRegistration |
Returns
void
Since
Lens Scripting Version 265
deleteLayer()
deleteLayer(
layerName):void
Delete the AnimationPropertyLayer named layerName.
Parameters
| Parameter | Type |
|---|---|
layerName | string |
Returns
void
Since
Lens Scripting Version 253
getLayer()
getLayer(
layerName):AnimationPropertyLayer
Retrieves an animation associated with a particular object.
Parameters
| Parameter | Type |
|---|---|
layerName | string |
Returns
Since
Lens Scripting Version 253
getTypeName()
staticgetTypeName():TypeName<AnimationAsset>
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<AnimationAsset>
Since
Lens Scripting Version 253
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
Inherited from
Nested types
Variables
| Variable | Description |
|---|---|
| selfLayerName | Special layer name that resolves to the SceneObject the AnimationPlayer is attached to, allowing animations to work regardless of the SceneObject's name. |