Motion
Get Motion

ReferenceScripting APIMotionEvents

MotionEvents

interface

The events scene.on hears, and what each hands its function.

NameMotionEvents
Kindinterface
Since0.3

Syntax

interface MotionEvents { … }

Properties

NameTypeDescription
clickproperty(x: number, y: number, button: number) => voidA click or tap on the wallpaper: where (0 to 1), and which button (0 the main one).
pressproperty(x: number, y: number, button: number, down: boolean) => voidA button of the pointer pressed (down) or let go: where (0 to 1), and which (0 the main one).
pointerproperty(x: number, y: number) => voidThe pointer moving over the wallpaper: where (0 to 1).
beatproperty(count: number) => voidA beat of what's playing: how many there have been.
tickproperty(time: number, dt: number) => voidEach tick: the scene's time and the seconds since the last.
propsproperty(props: Record<string, any>) => voidThe wallpaper's settings changed: all of them.
pauseproperty() => voidIt stopped playing (covered, on battery, by hand).
resumeproperty() => voidIt plays again.
resizeproperty(width: number, height: number) => voidIts size changed: its width and height in pixels.
sensorproperty(id: string, value: any, at: number, name: string) => voidA new reading of one of the scene's sensors: its id, its value, when (ms), and the name it's shared as.
moteClickproperty(id: string, x: number, y: number, mote: Mote) => voidA mote clicked: its id, where (0 to 1), and the mote.
hitproperty(a: string, b: string, moteA: Mote, moteB: Mote) => voidTwo motes' bodies started touching: their ids, and the motes.
pageproperty(layer: string, data: any) => voidA web project's page said something (its motion.send): its layer's id, and what.
mediaproperty(media: MotionMedia | null) => voidWhat's playing changed (another track, paused, played): as scene.media has it.
weatherproperty(weather: MotionWeather | null) => voidThe desktop's weather changed (or was first told): as scene.weather has it.
hitEndproperty(a: string, b: string, moteA: Mote, moteB: Mote) => voidTwo motes' bodies stopped touching: their ids, and the motes.
moteEnterproperty(id: string, mote: Mote) => voidThe pointer came over a mote: its id, and the mote.
moteLeaveproperty(id: string, mote: Mote) => voidThe pointer left a mote: its id, and the mote.
hoverproperty(over: boolean) => voidThe pointer came over the wallpaper (true) or left it (false).
wheelproperty(dx: number, dy: number) => voidThe wheel turned: notches across and down (down positive away from you).
dragproperty(x: number, y: number, dx: number, dy: number, button: number) => voidThe pointer moved with a button held: where (0 to 1), how far since (0 to 1), and the button.
dblclickproperty(x: number, y: number) => voidTwo clicks close together, in a third of a second: where (0 to 1).
layerClickproperty(layer: string, x: number, y: number) => voidA click on a layer (the top one drawn there): its id, and where (0 to 1).
videoEndproperty(layer: string) => voidA video layer's film went round to its start again: the layer's id.
loudproperty(level: number) => voidWhat's playing got louder than options.level (0.6 unless given): how loud. Once until it drops back.
quietproperty() => voidWhat's playing has been quieter than options.level (0.05) for options.seconds (2): the music stopped.
minuteproperty(hour: number, minute: number) => voidThe clock's minute changed: the hour and minute.
hourChangedproperty(hour: number) => voidThe clock's hour changed: the hour.
dayChangedproperty(clock: MotionClock) => voidMidnight: a new day, as scene.clock has it.
calendarproperty(calendar: { events: MotionEvent[] } | null) => voidThe calendar's events changed (or were first told): as scene.calendar has them.
systemproperty(system: MotionSystem | null) => voidThe computer's load was read again: as scene.system has it.
qualityproperty(quality: number) => voidHow finely it's drawn changed (scene.quality, 0 to 1).
markerproperty(name: string, time: number) => voidThe timeline passed one of its markers: its name, and its time (seconds).
keyproperty(code: number, down: boolean, repeat: boolean, text: string) => voidA key pressed or let go, only while the scene has the keyboard (requestInput): its code, whether down, whether it repeats, what it types.
padproperty(buttons: number, axes: number[]) => voidThe first gamepad, only while the scene has the input: its buttons (a bit each) and its six axes (-1 to 1).
capturedproperty(on: boolean) => voidThe scene was given the keyboard and pointer (true) or they were taken back (false).

See also

Mote · MotionMedia · MotionWeather · MotionClock · MotionEvent · MotionSystem