Represents a scriptable Animation node.
public class Animation : Sansar.Script.InstanceInterfaceMembers at a glance
| Kind | Members |
|---|---|
| Methods | GetFrameCount · GetName · GetParameters · IsPaused · JumpToFrame · Pause · Play · Reset · SetParameters |
Methods
GetFrameCount
public int GetFrameCount()Gets the frame count of the animation
Returns: int — Returns the total number of frames in the animation.
GetName
public string GetName()Gets the name of the animation
Returns: string — Returns the name of the animation.
GetParameters
public AnimationParameters GetParameters()Gets the last applied parameters for the animation
Returns: AnimationParameters — Returns the current parameters.
IsPaused
public bool IsPaused()Gets whether or not the animation is paused.
Returns: bool — A bool value indicating the pause state.
JumpToFrame
public void JumpToFrame(int frame)Jump to frame. The animation will be set to the specified frame, and paused.
| Parameter | Type | Description |
|---|---|---|
frame | int | Frame to jump to. |
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong JumpToFrame(
int frame,
Sansar.Script.ScriptBase.OperationComplete handler
)Jump to frame. The animation will be set to the specified frame, and paused.
| Parameter | Type | Description |
|---|---|---|
frame | int | Frame to jump to. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler to be called when the event completes. |
Returns: ulong — Returns an internal event id.
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
public void JumpToFrame(
int frame,
Action<Sansar.Script.OperationCompleteEvent> handler
)Jump to frame. The animation will be set to the specified frame, and paused.
| Parameter | Type | Description |
|---|---|---|
frame | int | Frame to jump to. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
Pause
public void Pause()Pauses the animation.
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong Pause(Sansar.Script.ScriptBase.OperationComplete handler)Pauses the animation.
| Parameter | Type | Description |
|---|---|---|
handler | Sansar.Script.ScriptBase.OperationComplete | Handler to be called when the event completes. |
Returns: ulong — Returns an internal event id.
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
public void Pause(
Action<Sansar.Script.OperationCompleteEvent> handler
)Pauses the animation.
| Parameter | Type | Description |
|---|---|---|
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
Play
public void Play()Plays the animation. It will become the active animation for this object, and resume playing if it is paused.
Remarks
If the animation has PlaybackMode.PlayOnce and has finished playing, this will have no effect, the animation will have to be reset with Reset() first. To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong Play(Sansar.Script.ScriptBase.OperationComplete handler)Plays the animation, without changing the current animation frame.
| Parameter | Type | Description |
|---|---|---|
handler | Sansar.Script.ScriptBase.OperationComplete | Handler to be called when the event completes. |
Returns: ulong — Returns an internal event id.
Remarks
If the animation has PlaybackMode.PlayOnce and has finished playing, this will have no effect, the animation will have to be reset with Reset() first. To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
public void Play(AnimationParameters parameters)Plays the animation and applies the provided parameters.
| Parameter | Type | Description |
|---|---|---|
parameters | AnimationParameters | Animation parameters to apply. |
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
public void Play(Action<Sansar.Script.OperationCompleteEvent> handler)Plays the animation. It will become the active animation for this object, and resume playing if it is paused.
| Parameter | Type | Description |
|---|---|---|
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
If the animation has PlaybackMode.PlayOnce and has finished playing, this will have no effect, the animation will have to be reset with Reset() first. To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong Play(
AnimationParameters parameters,
Sansar.Script.ScriptBase.OperationComplete handler
)Plays the animation and applies the provided parameters.
| Parameter | Type | Description |
|---|---|---|
parameters | AnimationParameters | Animation parameters to apply. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler to be called when the event completes. |
Returns: ulong — Returns an internal event id.
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
public void Play(
AnimationParameters parameters,
Action<Sansar.Script.OperationCompleteEvent> handler
)Plays the animation and applies the provided parameters.
| Parameter | Type | Description |
|---|---|---|
parameters | AnimationParameters | Animation parameters to apply. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
Reset
public void Reset()Resets the animation. The animation is paused and reset to frame 0 (or the RangeStartFrame if clamping is enabled).
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong Reset(Sansar.Script.ScriptBase.OperationComplete handler)Resets the animation. The animation is paused and reset to frame 0 (or the RangeStartFrame if clamping is enabled).
| Parameter | Type | Description |
|---|---|---|
handler | Sansar.Script.ScriptBase.OperationComplete | Handler to be called when the event completes. |
Returns: ulong — Returns an internal event id.
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
public void Reset(AnimationParameters parameters)Resets the animation and applies the provided parameters.
| Parameter | Type | Description |
|---|---|---|
parameters | AnimationParameters | Animation parameters to apply. |
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
public void Reset(
Action<Sansar.Script.OperationCompleteEvent> handler
)Resets the animation. The animation is paused and reset to frame 0 (or the RangeStartFrame if clamping is enabled).
| Parameter | Type | Description |
|---|---|---|
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong Reset(
AnimationParameters parameters,
Sansar.Script.ScriptBase.OperationComplete handler
)Resets the animation and applies the provided parameters.
| Parameter | Type | Description |
|---|---|---|
parameters | AnimationParameters | Animation parameters to apply. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler to be called when the event completes. |
Returns: ulong — Returns an internal event id.
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
public void Reset(
AnimationParameters parameters,
Action<Sansar.Script.OperationCompleteEvent> handler
)Resets the animation and applies the provided parameters.
| Parameter | Type | Description |
|---|---|---|
parameters | AnimationParameters | Animation parameters to apply. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
SetParameters
public void SetParameters(AnimationParameters parameters)Sets the parameters for the animation. The parameters are applied immediately.
| Parameter | Type | Description |
|---|---|---|
parameters | AnimationParameters | Animation parameters to apply. |
Remarks
The range start frame will be clamped to the length of the animation, and the range end frame will be clamped between the range start frame and the end of the animation. To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong SetParameters(
AnimationParameters parameters,
Sansar.Script.ScriptBase.OperationComplete handler
)Sets the parameters for the animation. The parameters are applied immediately.
| Parameter | Type | Description |
|---|---|---|
parameters | AnimationParameters | Animation parameters to apply. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler to be called when the event completes. |
Returns: ulong — Returns an internal event id.
Remarks
The range start frame will be clamped to the length of the animation, and the range end frame will be clamped between the range start frame and the end of the animation. To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
public void SetParameters(
AnimationParameters parameters,
Action<Sansar.Script.OperationCompleteEvent> handler
)Sets the parameters for the animation. The parameters are applied immediately.
| Parameter | Type | Description |
|---|---|---|
parameters | AnimationParameters | Animation parameters to apply. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
The range start frame will be clamped to the length of the animation, and the range end frame will be clamped between the range start frame and the end of the animation. To block until the method returns pass this to ScriptBase.WaitFor in a coroutine.
Used in examples
Generated from the Sansar 47.10.0 client ScriptApi snapshot.