Motion
Get Motion

ReferenceScripting APIShapeComponent

ShapeComponent

class

A Shape layer of a mote.

NameShapeComponent
Kindclass
Script reaches it asimport { ShapeComponent } from "motion"
Since0.3

Syntax

class ShapeComponent extends Component { … }

Properties

NameTypeDescription
namepropertyreadonly stringIts name on its mote.
layerpropertyreadonly stringIts layer's id.
visiblepropertybooleanWhether its layer shows.
opacitypropertynumberIts layer's opacity, 0 to 1.

Methods

SignatureDescription
new ShapeComponent(name?: string, layer?: string): ShapeComponentconstructorBinds a layer to a mote by hand. A mote's components are made with it, from the layers it's given in Studio, so you rarely need this.
set(key: string, value: SettingValue): voidmethodChanges one of its layer's settings.
animate(key: string, value: string | number, seconds: number, options?: MotionAnimateOptions): Promise<boolean>methodMoves one of its layer's settings.
stopAnimating(key?: string): voidmethodStops its layer's moves.
get(key: string): SettingValue | undefinedmethodOne of its layer's settings, as scene.get.
read(key: string): SettingValue | undefinedmethodOne of its layer's settings as last drawn, as scene.read.
show(visible?: boolean): voidmethodShows (or hides) its layer.
hide(): voidmethodHides its layer.

See also

SettingValue