ReferenceScripting APIJointComponent
JointComponent
classJoins its mote's body to another's (stage.join), from connect() until disconnect().
| Name | JointComponent |
|---|---|
| Kind | class |
| Script reaches it as | import { JointComponent } from "motion" |
| Since | 0.4 |
Syntax
class JointComponent 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. |
otherproperty | Mote | null | The other mote. |
jointproperty | MotionJointSpec | How they're joined. |
idproperty | readonly number | The joint's number (0 while not joined). |
Methods
| Signature | Description |
|---|---|
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. |
new JointComponent(name: string, mote: Mote, other: Mote, joint?: MotionJointSpec): JointComponentconstructor | Joins two motes' bodies. |
connect(): numbermethod | Joins them now. |
disconnect(): voidmethod | Lets them go. |
See also
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.