Motion
Get Motion

ReferenceScripting APIMeshComponent

MeshComponent

class

One item of a 3D layer: its settings are the item's own; a model's clips play here.

NameMeshComponent
Kindclass
Script reaches it asimport { MeshComponent } from "motion"
Since0.3

Syntax

class MeshComponent 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.
bonespropertyreadonly {}Its model's joints as last drawn, by name (after watchBones).

Methods

SignatureDescription
new MeshComponent(name?: string, layer?: string): MeshComponentconstructorBinds 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.
play(clip?: string, options?: { loop?: boolean | "pingpong" | "loop" | "once"; speed?: number; fade?: number }): voidmethodPlays a clip from its start, faded into from the one playing.
stop(): voidmethodHolds the clip where it is.
blendTo(clip: string, t: number, seconds?: number): voidmethodFades toward another clip, as far as t, at once or over seconds.
watchBones(): voidmethodAsks for its model's joints, which then come with each tick.
bone(name: string): { position: Vector3; rotation: { x: number; y: number; z: number; w: number } } | nullmethodOne of its model's joints.

See also

SettingValue · Vector3