Pressure pad
A walkable pad that briefly lights up and plays a sound on arrival.
What it demonstrates: Movement outputs · walkability · cosmetic steps · procedural sound.
Run this example
All learning examples are available in your developer world on scape.wtf. To edit this example, clone the public Scape tools repository and run its project with Node.js 22+:
sh
git clone https://github.com/scape-wtf/scape-tools.git
cd scape-tools
npm install
cd examples/gizmos/pressure-pad
npm run build
npm test
npm exec -- scape gizmo dev1
2
3
4
5
6
7
2
3
4
5
6
7
This connects to https://scape.wtf. Follow connection and approval. To make an independent project, copy this example directory outside the checkout, then run npm install, npm run build, npm test and npm exec -- scape gizmo dev there. Its manifest uses published SDK and CLI dependencies. The project's npm run dev script is a shortcut for scape gizmo dev.
Try changing it
Connect Someone steps on to the Lamp’s Toggle input, or While occupied to Power. Keep step feedback cosmetic; Scape supplies authoritative movement outputs.
Source
This code is included directly from the working example when the site builds.
src/definition.ts
ts
/** pressure-pad: SDK definition and authored behavior. Scape supplies the host services. */
import { defineObject, exactKeys, record } from '@scape-wtf/sdk';
/** Arrival feedback is temporary: there is no saved counter or permission-bearing action. */
export const pressurePad = defineObject<Record<string, never>>({
type: 'example.pressure-pad',
version: 1,
emoji: '🔘',
label: 'Pressure pad',
hint: 'walk or ride onto the pad to light it and play a note',
initial: () => ({}),
valid: (state): state is Record<string, never> => record(state) && exactKeys(state, []),
actions: {},
outputs: {
pressed: { label: 'Someone steps on', kind: 'event', source: 'arrival' },
released: { label: 'Someone steps off', kind: 'event', source: 'departure' },
occupied: { label: 'While occupied', kind: 'boolean', source: 'occupancy' },
},
walkable: true,
sounds: {
note: {
kind: 'synth',
duration: 0.35,
voices: [
{
wave: 'sine',
start: 0,
duration: 0.3,
frequency: 523.25,
gain: 0.2,
},
{
wave: 'sine',
start: 0,
duration: 0.2,
frequency: 1046.5,
gain: 0.06,
},
],
},
},
// Scape supplies one arrival per observed move. Standing still does not repeat it.
step: (_state, event) => ({
durationMs: 600,
lighting: {
light: {
color: event.movement === 'push' ? '#a28aff' : '#6bdfff',
radiusCells: 2,
intensity: 0.16,
basementIntensity: 0.25,
illumination: 0.6,
},
glow: {
color: '#6bdfff',
size: 65,
pulse: {
speed: 0,
amount: 0,
phaseX: 0,
},
opacity: {
base: 0.3,
amount: 0,
speed: 0,
phaseY: 0,
},
},
},
audio: [
{
kind: 'play',
voice: 'note',
sound: 'note',
delayMs: 0,
gain: 0.6,
rate: 1,
loop: false,
rangeCells: [1, 8],
stereo: 0.7,
},
],
}),
});
export default pressurePad;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
src/project.ts
ts
/** Project entry: exports pressure-pad to Scape's SDK loader. */
import { defineProject } from '@scape-wtf/sdk';
import { pressurePad } from './definition.js';
export default defineProject({
name: 'Pressure pad',
description:
'Step onto the pad to light it up and play a note. Connect it to Lamp or another gizmo to trigger a response.',
objects: [pressurePad],
});1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
