Animation
- Last UpdatedDec 07, 2023
- 4 minute read
Use the Animation node to map and command an animation of keyframe type that is associated to a mesh object.
During animation, you cannot move or rotate the animated mesh object because the animation specifies absolute position and rotation of the associated mesh.
Platform support
This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable WASM platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Animating multiple meshes
Sometimes, you might need to animate a complex of meshes and this results in a bunch of .amk objects in the model export.
The animation node is designed to handle 1 to n animated elements together.
To animate multiple meshes
-
Specify the animated elements to manage together in the animation field. Separate the elements with commas.
Modes
There are two main modes to play animation: direct and time.
Direct mode
The direct mode is the standard mode.
-
Use Play, Stop, Pause events to manage animation execution.
-
Use Speed to decrease speed, increase speed, or even invert animation direction.
-
Use Loop to play the animation repeatedly.
Timer mode
The timer mode offers greater control of the animation playback.
|
Timer mode |
Description |
|---|---|
|
timeRange |
Use this to play part of the animation. You can define the start and the end point on the timeline, expressed in seconds. For example, [0 -1] plays from init to end. [-1 0] plays reversed. [3.5 7] plays from 3.5 seconds to 7 seconds (-1 is a shortcut for final end time). |
|
timeRangeDuration |
Use this to slow down and increase speed of the animation (-1 means keep normal time). |
Code example
This is a code example for the Animation node.
<Animation animation="Dummy_Macchina" start="true" loop="true"/>
Position
The Animation node must be inside a context node, such as Context or Global.
Animation fields
These are the fields for Animation node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > Animation
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
animation |
sstring |
Mandatory |
Not set |
The fully qualified name of the animated elements to be managed together. |
|
autostart |
sbool |
Optional |
false |
When true, the animation plays automatically when the application starts. |
|
currentAlpha |
sfloat |
Optional |
0 |
Calculates the current alpha during play. Can also be used to drive the animation or to set to a particular position. The 0-1 range can be driven by many other nodes. |
|
currentTime |
sfloat |
Optional |
0 |
Calculates the current time during play. Can also be used to drive the animation or to set to a particular position. |
|
endTime |
sfloat |
Optional |
0 |
Sets the animation end to a particular position of the animation, in seconds. |
|
length |
sfloat |
Read only |
Maximum animation node time length |
Reads the animation length in seconds. |
|
loop |
sbool |
Optional |
false |
Plays the animation in a loop. |
|
mode |
senum |
Optional |
Direct |
Specifies the play mode: Direct or Timer. |
|
pause |
sevent |
Optional |
Not set |
Pauses the animation. |
|
skip |
sstring |
Optional |
Not set |
A space-separated list of animation nodes to skip during playing. |
|
speed |
sfloat |
Optional |
1 |
Speeds up the animation. |
|
start |
sevent |
Optional |
Not set |
Starts or restarts animation. Set to true for animation to automatically start at loading time. |
|
startTime |
sfloat |
Optional |
0 |
Sets the animation start to a particular position of the animation, in seconds. |
|
stop |
sevent |
Optional |
Not set |
Stops the animation. If the animation is not looped and reaches its end, this event is raised by the node to monitor animation status. |
|
timeDiv |
sfloat |
Optional |
1 |
Depending on the animation type, this value can adapt the animation frame rate to application frame rate. |
|
timeRange |
svec2 |
Optional |
0 -1 |
Available only if mode is set to timer. Restricts playback to a different range. |
|
timeRangeDuration |
sfloat |
Optional |
-1 |
Available only if mode is set to timer. Enables you to speed up or slow down the playback of the animation. |