Binding animation speed to item values
- Last UpdatedDec 04, 2023
- 1 minute read
This code example shows how to bind an animation speed to the value of an item. Examples could be a pump's internal animation or a conveyor speed.
Code example
In this example, the animation .loop is set to True. By setting the .start event at definition time, it automatically starts from the beginning.
Then the animation speed is linked to a gauge value scaling on its max.
<Animation name="P802_wheel_animation" animation="Section01|P802_wheel" loop="true" start="true"/>
<route from="gauge_P802.value" to="P802_wheel_animation.speed" value="#@gauge_P802.value@/@gauge_P802.needleScale.y@#" />
Note: To access the animation node and its fields, declare it.