ReferenceScript nodesUtilities › Flow Control
Throttle
Goes on at most once in the seconds, and once more at the end so the last call isn't lost.
◷Throttle
Duration1
Inputs
| Pin | Type | Starts at | Notes |
|---|---|---|---|
in | what happens next | – | – |
Durationseconds | number | 1 | – |
Outputs
| Pin | Type |
|---|---|
then | what happens next |
The code it becomes
The graph below written as a script would write it.
let q2 = { t: -1e9, waiting: false };// On Scene Start{ const secs = Math.max(0.1, 1); if (scene.time - q2.t >= secs) { q2.t = scene.time; } else if (!q2.waiting) { q2.waiting = true; scene.after(secs - (scene.time - q2.t), function () { q2.waiting = false; q2.t = scene.time; }); }}In a graph
◆On Scene Start
◷Throttle
Duration1
The node with what starts it and Print to show what it gives, as Studio draws them.
Related
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.