ReferenceScripting APIMotionLayer
MotionLayer
interfaceOne layer, to change without naming it each time (scene.layer).
| Name | MotionLayer |
|---|---|
| Kind | interface |
| Script reaches it as | MotionScene.layer() · MotionScene.clone() |
| Since | 0.3 |
Syntax
interface MotionLayer extends MotionLayerInfo { … }Properties
| Name | Type | Description |
|---|---|---|
idproperty | readonly string | The layer's id: its own, never shared ("" when there's no such layer). |
nameproperty | readonly string | The layer's name, as Studio shows it (a name can be shared). |
typeproperty | readonly string | The layer's kind: "gradient", "text", "particles"... |
folderproperty | readonly string | The id of the folder it's in, "" for none. |
existsproperty | readonly boolean | Whether the layer is there: false for a name no layer has, or one taken out (remove()). |
boundsproperty | readonly MotionBounds | null | The box round this layer as it was last drawn, 0 to 1 of the scene, and its turn. |
Methods
| Signature | Description |
|---|---|
set(setting: string, value: SettingValue): voidmethod | Changes one of this layer's settings at once. |
animate(setting: string, value: string | number, seconds: number, options?: MotionAnimateOptions): Promise<boolean>method | Moves one of this layer's number or colour settings smoothly. |
stopAnimating(setting?: string): voidmethod | Stops this layer's moves where they are now. |
get(setting: string): SettingValue | undefinedmethod | One of this layer's settings: what the script set, or what the scene started with (not what keyframes or the sound make it: see read). |
read(setting: string): SettingValue | undefinedmethod | One of this layer's settings as it was last drawn: its keyframes, the sound and the script's moves in. |
show(visible: boolean): voidmethod | Shows or hides this layer. |
hide(): voidmethod | Hides this layer. |
text(words: string): voidmethod | A Text layer's words. |
contains(x: number, y: number): booleanmethod | Whether a point of the scene is on this layer, as it was last drawn (its turn and scale in). |
effect(which: string | number): MotionEffectmethod | One of this layer's effects, by its number in the stack or its name (or its kind). |
uniform(name: string, value: SettingValue): voidmethod | Sets a Shader layer's (or a Shader effect's) own uniform, by name. |
material(name: string, value: SettingValue): voidmethod | Sets one of the layer's material's own settings, by name. |
bringToFront(): voidmethod | Moves this layer above the others beside it (in its folder). |
sendToBack(): voidmethod | Moves this layer below the others beside it (in its folder). |
clone(name?: string): MotionLayermethod | A copy of this layer, just above it, while the scene plays. |
remove(): voidmethod | Takes this layer out of the scene while it plays (the scene's file is as it was). |
See also
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.