You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: advanced/animations/README.md
+31-10Lines changed: 31 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -72,18 +72,39 @@ Furthermore, the scene graph now contains a Node which also has an animation obj
72
72
73
73

74
74
75
-
The animation is statically assigned to the node and its outputs are linked to the node transformation properties. Looking
76
-
at the Animation properties, you will see the animation channels alongside the state of the animation object and its current
77
-
output values:
75
+
The animation is statically assigned to the node and its outputs are linked to the node transformation properties.
76
+
You can experiment with the `progress` input of the animation object to see the animation in different phases/states:
78
77
79
78

80
79
81
-
You can set the "play", "loop" and "rewind on pause" properties or link them to scripts to control the state of the animation.
82
-
This works exactly as with other scripts, see the [section on linking Lua properties in the Monkey example](../../basics/monkey/README.md#Lua-Scripting) for details.
80
+
If you want to preview the animation in the Composer, you can create a `Timer` object (in the Resources View) and link
81
+
it to a control script which translates timer ticks to a normalized [0, 1] value which is linked to the animation `Progress` input.
83
82
84
-
## How to control time
83
+
Your script can look like this:
85
84
86
-
Currently there is no direct way to control the time progression of animations with Lua. We are addressing this
87
-
in the logic engine and will update this tutorial after we have a solution. In Ramses Composer 0.11.0, the time is
88
-
automatically passed to all animation objects in a strictly progressing fashion, and scripts are only allowed to set
89
-
the state of an animation - running, paused, stopped, and rewind.
85
+
```lua
86
+
87
+
functioninterface(IN,OUT)
88
+
IN.ticker=Type:Int64()
89
+
OUT.animationProgress=Type:Float()
90
+
end
91
+
92
+
functionrun(IN,OUT)
93
+
-- Total duration of the animation in seconds
94
+
localdurationInSeconds=3
95
+
-- How many microseconds are needed to fill the progress from 0 -> 1
96
+
localnormalizeFactor=1000000*durationInSeconds
97
+
-- Convert timer ticks to progress and normalizing to [0, 1]
0 commit comments