Motion
Get Motion

ReferenceScripting APIVideoComponent

VideoComponent

class

A Video layer of a mote.

NameVideoComponent
Kindclass
Script reaches it asimport { VideoComponent } from "motion"
Since0.3

Syntax

class VideoComponent 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.
timepropertyreadonly numberWhere it is in its film, seconds.
durationpropertyreadonly numberHow long its film is, seconds (0 when the file doesn't say).
playingpropertyreadonly booleanWhether it's playing.
ratepropertyreadonly numberIts speed (1 as it is, 0 held).

Methods

SignatureDescription
new VideoComponent(name?: string, layer?: string): VideoComponentconstructorBinds 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(): voidmethodPlays it.
pause(): voidmethodHolds it on its frame.
seek(seconds: number): voidmethodGoes to a place in the film.
setRate(rate: number): voidmethodPlays it faster or slower.

See also

SettingValue