ReferenceScripting APIMotionSceneanimate
MotionScene.animate
methodMoves a number or a colour setting to a new value smoothly, over some seconds.
| Name | animate |
|---|---|
| Kind | method of MotionScene |
| Called as | scene.animate(…) |
| As a node | Move Layer Setting To (logic graph) |
| Since | 0.3 |
Syntax
animate( layer: string, setting: string, value: string | number, seconds: number, options?: MotionAnimateOptions): Promise<boolean>Parameters
| Name | Type | Description |
|---|---|---|
layer | string | The layer's name or id, or a folder's |
setting | string | A number or colour setting |
value | string | number | Where it ends up |
seconds | number | How long the move takes |
options | MotionAnimateOptions | Optional. Its easing ("easeInOut" unless given), delay (seconds) and loop (true, or "pingpong") |
Returns
Promise<boolean>: a promise of true when it gets there, false when it's stopped or a move or set of the same setting takes over.
Remarks
A layer that isn't there does nothing (the console says so once), and the promise gives false. A move that loops never gets there.
Example
await scene.animate("Moon", "y", 0.2, 4, { easing: "sineInOut" });scene.animate("Glow", "opacity", 1, 1);See also
MotionAnimateOptions · In examples: Constellations, Kelp Forest, Rain Harbour, Resonance, Valley Hours
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.