ReferenceScripting APIMotionEvents
MotionEvents
interfaceThe events scene.on hears, and what each hands its function.
| Name | MotionEvents |
|---|---|
| Kind | interface |
| Since | 0.3 |
Syntax
interface MotionEvents { … }Properties
| Name | Type | Description |
|---|---|---|
clickproperty | (x: number, y: number, button: number) => void | A 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) => void | A button of the pointer pressed (down) or let go: where (0 to 1), and which (0 the main one). |
pointerproperty | (x: number, y: number) => void | The pointer moving over the wallpaper: where (0 to 1). |
beatproperty | (count: number) => void | A beat of what's playing: how many there have been. |
tickproperty | (time: number, dt: number) => void | Each tick: the scene's time and the seconds since the last. |
propsproperty | (props: Record<string, any>) => void | The wallpaper's settings changed: all of them. |
pauseproperty | () => void | It stopped playing (covered, on battery, by hand). |
resumeproperty | () => void | It plays again. |
resizeproperty | (width: number, height: number) => void | Its size changed: its width and height in pixels. |
sensorproperty | (id: string, value: any, at: number, name: string) => void | A 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) => void | A mote clicked: its id, where (0 to 1), and the mote. |
hitproperty | (a: string, b: string, moteA: Mote, moteB: Mote) => void | Two motes' bodies started touching: their ids, and the motes. |
pageproperty | (layer: string, data: any) => void | A web project's page said something (its motion.send): its layer's id, and what. |
mediaproperty | (media: MotionMedia | null) => void | What's playing changed (another track, paused, played): as scene.media has it. |
weatherproperty | (weather: MotionWeather | null) => void | The desktop's weather changed (or was first told): as scene.weather has it. |
hitEndproperty | (a: string, b: string, moteA: Mote, moteB: Mote) => void | Two motes' bodies stopped touching: their ids, and the motes. |
moteEnterproperty | (id: string, mote: Mote) => void | The pointer came over a mote: its id, and the mote. |
moteLeaveproperty | (id: string, mote: Mote) => void | The pointer left a mote: its id, and the mote. |
hoverproperty | (over: boolean) => void | The pointer came over the wallpaper (true) or left it (false). |
wheelproperty | (dx: number, dy: number) => void | The wheel turned: notches across and down (down positive away from you). |
dragproperty | (x: number, y: number, dx: number, dy: number, button: number) => void | The pointer moved with a button held: where (0 to 1), how far since (0 to 1), and the button. |
dblclickproperty | (x: number, y: number) => void | Two clicks close together, in a third of a second: where (0 to 1). |
layerClickproperty | (layer: string, x: number, y: number) => void | A click on a layer (the top one drawn there): its id, and where (0 to 1). |
videoEndproperty | (layer: string) => void | A video layer's film went round to its start again: the layer's id. |
loudproperty | (level: number) => void | What's playing got louder than options.level (0.6 unless given): how loud. Once until it drops back. |
quietproperty | () => void | What's playing has been quieter than options.level (0.05) for options.seconds (2): the music stopped. |
minuteproperty | (hour: number, minute: number) => void | The clock's minute changed: the hour and minute. |
hourChangedproperty | (hour: number) => void | The clock's hour changed: the hour. |
dayChangedproperty | (clock: MotionClock) => void | Midnight: a new day, as scene.clock has it. |
calendarproperty | (calendar: { events: MotionEvent[] } | null) => void | The calendar's events changed (or were first told): as scene.calendar has them. |
systemproperty | (system: MotionSystem | null) => void | The computer's load was read again: as scene.system has it. |
qualityproperty | (quality: number) => void | How finely it's drawn changed (scene.quality, 0 to 1). |
markerproperty | (name: string, time: number) => void | The timeline passed one of its markers: its name, and its time (seconds). |
keyproperty | (code: number, down: boolean, repeat: boolean, text: string) => void | A 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[]) => void | The first gamepad, only while the scene has the input: its buttons (a bit each) and its six axes (-1 to 1). |
capturedproperty | (on: boolean) => void | The scene was given the keyboard and pointer (true) or they were taken back (false). |
See also
Mote · MotionMedia · MotionWeather · MotionClock · MotionEvent · MotionSystem
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.