ReferenceScripting APIMotionSceneevery
MotionScene.every
methodRuns a function again and again, every so many seconds.
| Name | every |
|---|---|
| Kind | method of MotionScene |
| Called as | scene.every(…) |
| As a node | On Timer (logic graph) |
| Since | 0.3 |
Syntax
every( seconds: number, fn: () => void): numberParameters
| Name | Type | Description |
|---|---|---|
seconds | number | How often; any time, run at the first tick it's due |
fn | () => void | The function to run |
Returns
number: an id, for scene.cancel.
Example
scene.every(1, () => scene.setVar("second", new Date().getSeconds()));See also
In examples: Constellations, Valley Hours
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.