ReferenceScripting APIMotionVoice
MotionVoice
interfaceOne playing of a sound: turned, panned, sped, moved, stopped, or crossed over to another sound. Read it with its properties, change it with its methods.
| Name | MotionVoice |
|---|---|
| Kind | interface |
| Script reaches it as | MotionSound.play() |
| Since | 0.3 |
Syntax
interface MotionVoice { … }Properties
| Name | Type | Description |
|---|---|---|
idproperty | readonly number | Its number. |
playingproperty | readonly boolean | Whether it's still playing (as of the last frame). |
volumeproperty | readonly number | Its volume, 0 to 2. |
panproperty | readonly number | Its pan, -1 left to 1 right. |
rateproperty | readonly number | Its speed, 0.25 to 4 (faster is higher). |
positionproperty | readonly number | Where it is in its sound, seconds (as of the last frame). |
endedproperty | readonly Promise<void> | A promise of its ending: played out, or stopped. |
Methods
| Signature | Description |
|---|---|
stop(options?: { fadeOut?: number }): voidmethod | Stops it, at once or fading out. |
setVolume(volume: number): voidmethod | Turns it up or down. |
setPan(pan: number): voidmethod | Pans it. |
setRate(rate: number): voidmethod | Plays it faster (and higher) or slower. |
seek(seconds: number): voidmethod | Moves it to a place in its sound. |
crossfadeTo(other: MotionSound, seconds: number): MotionVoicemethod | Fades this voice out as another sound fades in, over seconds. |
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.