Motion
Get Motion

ReferenceScripting APIMotionLayer

MotionLayer

interface

One layer, to change without naming it each time (scene.layer).

NameMotionLayer
Kindinterface
Script reaches it asMotionScene.layer() · MotionScene.clone()
Since0.3

Syntax

interface MotionLayer extends MotionLayerInfo { … }

Properties

NameTypeDescription
idpropertyreadonly stringThe layer's id: its own, never shared ("" when there's no such layer).
namepropertyreadonly stringThe layer's name, as Studio shows it (a name can be shared).
typepropertyreadonly stringThe layer's kind: "gradient", "text", "particles"...
folderpropertyreadonly stringThe id of the folder it's in, "" for none.
existspropertyreadonly booleanWhether the layer is there: false for a name no layer has, or one taken out (remove()).
boundspropertyreadonly MotionBounds | nullThe box round this layer as it was last drawn, 0 to 1 of the scene, and its turn.

Methods

SignatureDescription
set(setting: string, value: SettingValue): voidmethodChanges one of this layer's settings at once.
animate(setting: string, value: string | number, seconds: number, options?: MotionAnimateOptions): Promise<boolean>methodMoves one of this layer's number or colour settings smoothly.
stopAnimating(setting?: string): voidmethodStops this layer's moves where they are now.
get(setting: string): SettingValue | undefinedmethodOne 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 | undefinedmethodOne of this layer's settings as it was last drawn: its keyframes, the sound and the script's moves in.
show(visible: boolean): voidmethodShows or hides this layer.
hide(): voidmethodHides this layer.
text(words: string): voidmethodA Text layer's words.
contains(x: number, y: number): booleanmethodWhether a point of the scene is on this layer, as it was last drawn (its turn and scale in).
effect(which: string | number): MotionEffectmethodOne of this layer's effects, by its number in the stack or its name (or its kind).
uniform(name: string, value: SettingValue): voidmethodSets a Shader layer's (or a Shader effect's) own uniform, by name.
material(name: string, value: SettingValue): voidmethodSets one of the layer's material's own settings, by name.
bringToFront(): voidmethodMoves this layer above the others beside it (in its folder).
sendToBack(): voidmethodMoves this layer below the others beside it (in its folder).
clone(name?: string): MotionLayermethodA copy of this layer, just above it, while the scene plays.
remove(): voidmethodTakes this layer out of the scene while it plays (the scene's file is as it was).

See also

SettingValue · MotionBounds · MotionEffect