ReferenceScripting APIMeshComponent
MeshComponent
classOne item of a 3D layer: its settings are the item's own; a model's clips play here.
| Name | MeshComponent |
|---|---|
| Kind | class |
| Script reaches it as | import { MeshComponent } from "motion" |
| Since | 0.3 |
Syntax
class MeshComponent extends Component { … }Properties
| Name | Type | Description |
|---|---|---|
nameproperty | readonly string | Its name on its mote. |
layerproperty | readonly string | Its layer's id. |
visibleproperty | boolean | Whether its layer shows. |
opacityproperty | number | Its layer's opacity, 0 to 1. |
bonesproperty | readonly {} | Its model's joints as last drawn, by name (after watchBones). |
Methods
| Signature | Description |
|---|---|
new MeshComponent(name?: string, layer?: string): MeshComponentconstructor | Binds 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): voidmethod | Changes one of its layer's settings. |
animate(key: string, value: string | number, seconds: number, options?: MotionAnimateOptions): Promise<boolean>method | Moves one of its layer's settings. |
stopAnimating(key?: string): voidmethod | Stops its layer's moves. |
get(key: string): SettingValue | undefinedmethod | One of its layer's settings, as scene.get. |
read(key: string): SettingValue | undefinedmethod | One of its layer's settings as last drawn, as scene.read. |
show(visible?: boolean): voidmethod | Shows (or hides) its layer. |
hide(): voidmethod | Hides its layer. |
play(clip?: string, options?: { loop?: boolean | "pingpong" | "loop" | "once"; speed?: number; fade?: number }): voidmethod | Plays a clip from its start, faded into from the one playing. |
stop(): voidmethod | Holds the clip where it is. |
blendTo(clip: string, t: number, seconds?: number): voidmethod | Fades toward another clip, as far as t, at once or over seconds. |
watchBones(): voidmethod | Asks 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 } } | nullmethod | One of its model's joints. |
See also
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.