@viji-dev/core 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artist-dts-p5.js +1 -1
- package/dist/artist-dts.js +1 -1
- package/dist/artist-global-p5.d.ts +67 -67
- package/dist/artist-global.d.ts +67 -67
- package/dist/artist-jsdoc.d.ts +59 -59
- package/dist/docs-api.js +103 -31
- package/dist/index-G2N9Tgtd.js.map +1 -1
- package/dist/index.d.ts +66 -66
- package/package.json +1 -1
|
@@ -25,15 +25,15 @@ declare global {
|
|
|
25
25
|
};
|
|
26
26
|
/** Energy in five fixed frequency bands, plus a smoothed companion (~150ms decay) for each. All in 0..1. */
|
|
27
27
|
bands: {
|
|
28
|
-
/** Instant low-band energy (20
|
|
28
|
+
/** Instant low-band energy (20-120 Hz, bass/kick range). 0..1. */
|
|
29
29
|
low: number;
|
|
30
|
-
/** Instant low-mid energy (120
|
|
30
|
+
/** Instant low-mid energy (120-400 Hz). 0..1. */
|
|
31
31
|
lowMid: number;
|
|
32
|
-
/** Instant mid energy (400
|
|
32
|
+
/** Instant mid energy (400-1600 Hz, vocals/instruments). 0..1. */
|
|
33
33
|
mid: number;
|
|
34
|
-
/** Instant high-mid energy (1600
|
|
34
|
+
/** Instant high-mid energy (1600-6000 Hz, cymbals/hi-hats). 0..1. */
|
|
35
35
|
highMid: number;
|
|
36
|
-
/** Instant high-band energy (6000
|
|
36
|
+
/** Instant high-band energy (6000-16000 Hz, air/brilliance). 0..1. */
|
|
37
37
|
high: number;
|
|
38
38
|
/** Smoothed `low` (~150ms decay). 0..1. */
|
|
39
39
|
lowSmoothed: number;
|
|
@@ -93,15 +93,15 @@ declare global {
|
|
|
93
93
|
};
|
|
94
94
|
/** High-level spectral features derived from the FFT. */
|
|
95
95
|
spectral: {
|
|
96
|
-
/** Normalized spectral centroid in 0..1
|
|
96
|
+
/** Normalized spectral centroid in 0..1. Higher values mean brighter, more treble-heavy sound. */
|
|
97
97
|
brightness: number;
|
|
98
|
-
/** Normalized spectral flatness in 0..1
|
|
98
|
+
/** Normalized spectral flatness in 0..1. Higher values mean noisier (white-noise-like) sound; lower values mean tonal. */
|
|
99
99
|
flatness: number;
|
|
100
100
|
};
|
|
101
101
|
/**
|
|
102
102
|
* Returns the raw FFT magnitude spectrum as a `Uint8Array` (1024 bins, each 0..255).
|
|
103
103
|
* Bin `i` covers frequency `i × (sampleRate / fftSize)`. The returned array is a
|
|
104
|
-
* snapshot from the latest analysis tick
|
|
104
|
+
* snapshot from the latest analysis tick; repeated calls in the same frame return the same data.
|
|
105
105
|
*
|
|
106
106
|
* @example
|
|
107
107
|
* const fft = viji.audio.getFrequencyData();
|
|
@@ -110,7 +110,7 @@ declare global {
|
|
|
110
110
|
getFrequencyData: () => Uint8Array;
|
|
111
111
|
/**
|
|
112
112
|
* Returns the raw time-domain waveform as a `Float32Array` (2048 PCM samples in -1..1).
|
|
113
|
-
* The returned array is a snapshot
|
|
113
|
+
* The returned array is a snapshot; repeated calls in the same frame return the same data.
|
|
114
114
|
*
|
|
115
115
|
* @example
|
|
116
116
|
* const wave = viji.audio.getWaveform();
|
|
@@ -121,7 +121,7 @@ declare global {
|
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
123
|
* Lightweight audio analysis for additional or device audio streams. A strict
|
|
124
|
-
* subset of `AudioAPI`
|
|
124
|
+
* subset of `AudioAPI` that exposes volume, frequency bands, spectral features,
|
|
125
125
|
* and raw FFT/waveform access, but **no beat detection** (no `beat`, no BPM,
|
|
126
126
|
* no triggers, no events).
|
|
127
127
|
*/
|
|
@@ -139,15 +139,15 @@ declare global {
|
|
|
139
139
|
};
|
|
140
140
|
/** Energy in five fixed frequency bands, plus a smoothed companion (~150ms decay) for each. All in 0..1. */
|
|
141
141
|
bands: {
|
|
142
|
-
/** Instant low-band energy (20
|
|
142
|
+
/** Instant low-band energy (20-120 Hz). 0..1. */
|
|
143
143
|
low: number;
|
|
144
|
-
/** Instant low-mid energy (120
|
|
144
|
+
/** Instant low-mid energy (120-400 Hz). 0..1. */
|
|
145
145
|
lowMid: number;
|
|
146
|
-
/** Instant mid energy (400
|
|
146
|
+
/** Instant mid energy (400-1600 Hz). 0..1. */
|
|
147
147
|
mid: number;
|
|
148
|
-
/** Instant high-mid energy (1600
|
|
148
|
+
/** Instant high-mid energy (1600-6000 Hz). 0..1. */
|
|
149
149
|
highMid: number;
|
|
150
|
-
/** Instant high-band energy (6000
|
|
150
|
+
/** Instant high-band energy (6000-16000 Hz). 0..1. */
|
|
151
151
|
high: number;
|
|
152
152
|
/** Smoothed `low` (~150ms decay). 0..1. */
|
|
153
153
|
lowSmoothed: number;
|
|
@@ -169,19 +169,19 @@ declare global {
|
|
|
169
169
|
};
|
|
170
170
|
/**
|
|
171
171
|
* Returns the raw FFT magnitude spectrum for this stream as a `Uint8Array`
|
|
172
|
-
* (1024 bins, each 0..255). Snapshot semantics
|
|
172
|
+
* (1024 bins, each 0..255). Snapshot semantics; see `AudioAPI.getFrequencyData`.
|
|
173
173
|
*/
|
|
174
174
|
getFrequencyData: () => Uint8Array;
|
|
175
175
|
/**
|
|
176
176
|
* Returns the raw time-domain waveform for this stream as a `Float32Array`
|
|
177
|
-
* (2048 samples, each -1..1). Snapshot semantics
|
|
177
|
+
* (2048 samples, each -1..1). Snapshot semantics; see `AudioAPI.getWaveform`.
|
|
178
178
|
*/
|
|
179
179
|
getWaveform: () => Float32Array;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
/**
|
|
183
183
|
* Configuration object passed to `viji.button()`. The host renders a clickable
|
|
184
|
-
* momentary button
|
|
184
|
+
* momentary button. The resulting `value` is `true` for one frame after press,
|
|
185
185
|
* then auto-resets to `false`.
|
|
186
186
|
*/
|
|
187
187
|
interface ButtonConfig {
|
|
@@ -191,12 +191,12 @@ declare global {
|
|
|
191
191
|
description?: string;
|
|
192
192
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
193
193
|
group?: string;
|
|
194
|
-
/** Visibility category
|
|
194
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
195
195
|
category?: ParameterCategory;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
|
-
* Reactive object returned by `viji.button()`. `value` is a momentary flag
|
|
199
|
+
* Reactive object returned by `viji.button()`. `value` is a momentary flag:
|
|
200
200
|
* `true` for exactly one frame after the user clicks, then auto-resets to
|
|
201
201
|
* `false`. Use it to trigger discrete events from `render()`.
|
|
202
202
|
*/
|
|
@@ -209,7 +209,7 @@ declare global {
|
|
|
209
209
|
description?: string;
|
|
210
210
|
/** Group name under which the control appears in the UI. */
|
|
211
211
|
group: string;
|
|
212
|
-
/** Visibility category
|
|
212
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
213
213
|
category: ParameterCategory;
|
|
214
214
|
}
|
|
215
215
|
|
|
@@ -242,7 +242,7 @@ declare global {
|
|
|
242
242
|
description?: string;
|
|
243
243
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
244
244
|
group?: string;
|
|
245
|
-
/** Visibility category
|
|
245
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
246
246
|
category?: ParameterCategory;
|
|
247
247
|
}
|
|
248
248
|
|
|
@@ -303,7 +303,7 @@ declare global {
|
|
|
303
303
|
description?: string;
|
|
304
304
|
/** Group name under which the control appears in the UI. */
|
|
305
305
|
group: string;
|
|
306
|
-
/** Visibility category
|
|
306
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
307
307
|
category: ParameterCategory;
|
|
308
308
|
}
|
|
309
309
|
|
|
@@ -320,7 +320,7 @@ declare global {
|
|
|
320
320
|
description?: string;
|
|
321
321
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
322
322
|
group?: string;
|
|
323
|
-
/** Visibility category
|
|
323
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
324
324
|
category?: ParameterCategory;
|
|
325
325
|
}
|
|
326
326
|
|
|
@@ -339,7 +339,7 @@ declare global {
|
|
|
339
339
|
description?: string;
|
|
340
340
|
/** Group name under which the control appears in the UI. */
|
|
341
341
|
group: string;
|
|
342
|
-
/** Visibility category
|
|
342
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
343
343
|
category: ParameterCategory;
|
|
344
344
|
}
|
|
345
345
|
|
|
@@ -363,7 +363,7 @@ declare global {
|
|
|
363
363
|
/**
|
|
364
364
|
* Computer-vision processing rate relative to the scene's render rate.
|
|
365
365
|
* `'full'` runs CV every frame, `'half'` every other frame, `'quarter'` every
|
|
366
|
-
* fourth, `'eighth'` every eighth
|
|
366
|
+
* fourth, `'eighth'` every eighth. Lower rates reduce CPU/GPU cost.
|
|
367
367
|
*/
|
|
368
368
|
type CVFrameRateMode = 'full' | 'half' | 'quarter' | 'eighth';
|
|
369
369
|
|
|
@@ -678,7 +678,7 @@ declare global {
|
|
|
678
678
|
/** Depth (relative). */
|
|
679
679
|
z: number;
|
|
680
680
|
}[];
|
|
681
|
-
/** Palm center
|
|
681
|
+
/** Palm center, equivalent to `landmarks[9]` (middle-finger MCP). */
|
|
682
682
|
palm: {
|
|
683
683
|
/** Palm horizontal coordinate, normalized 0..1. */
|
|
684
684
|
x: number;
|
|
@@ -721,7 +721,7 @@ declare global {
|
|
|
721
721
|
description?: string;
|
|
722
722
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
723
723
|
group?: string;
|
|
724
|
-
/** Visibility category
|
|
724
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
725
725
|
category?: ParameterCategory;
|
|
726
726
|
}
|
|
727
727
|
|
|
@@ -733,7 +733,7 @@ declare global {
|
|
|
733
733
|
interface ImageParameter {
|
|
734
734
|
/** Uploaded image as an `ImageBitmap`, or `null` until the user provides one. */
|
|
735
735
|
value: ImageBitmap | null;
|
|
736
|
-
/** P5-compatible image wrapper. Only available in the P5 renderer
|
|
736
|
+
/** P5-compatible image wrapper. Only available in the P5 renderer; added at runtime by the P5 adapter. */
|
|
737
737
|
readonly p5?: any;
|
|
738
738
|
/** Display name shown next to the upload field in the parameter UI. */
|
|
739
739
|
label: string;
|
|
@@ -741,7 +741,7 @@ declare global {
|
|
|
741
741
|
description?: string;
|
|
742
742
|
/** Group name under which the control appears in the UI. */
|
|
743
743
|
group: string;
|
|
744
|
-
/** Visibility category
|
|
744
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
745
745
|
category: ParameterCategory;
|
|
746
746
|
/**
|
|
747
747
|
* P5-compatible image object (lazy-loaded, auto-converted from .value)
|
|
@@ -854,7 +854,7 @@ declare global {
|
|
|
854
854
|
description?: string;
|
|
855
855
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
856
856
|
group?: string;
|
|
857
|
-
/** Visibility category
|
|
857
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
858
858
|
category?: ParameterCategory;
|
|
859
859
|
}
|
|
860
860
|
|
|
@@ -877,7 +877,7 @@ declare global {
|
|
|
877
877
|
description?: string;
|
|
878
878
|
/** Group name under which the control appears in the UI. */
|
|
879
879
|
group: string;
|
|
880
|
-
/** Visibility category
|
|
880
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
881
881
|
category: ParameterCategory;
|
|
882
882
|
}
|
|
883
883
|
|
|
@@ -905,7 +905,7 @@ declare global {
|
|
|
905
905
|
deltaX: number;
|
|
906
906
|
/** Vertical movement since the last frame in pixels. */
|
|
907
907
|
deltaY: number;
|
|
908
|
-
/** `true` while the pointer is "down"
|
|
908
|
+
/** `true` while the pointer is "down": left mouse button held, or a touch active. */
|
|
909
909
|
isDown: boolean;
|
|
910
910
|
/** `true` for exactly one frame when the pointer becomes down, then auto-resets. */
|
|
911
911
|
wasPressed: boolean;
|
|
@@ -913,7 +913,7 @@ declare global {
|
|
|
913
913
|
wasReleased: boolean;
|
|
914
914
|
/** `true` while the pointer is within the canvas bounds. */
|
|
915
915
|
isInCanvas: boolean;
|
|
916
|
-
/** Currently active input source
|
|
916
|
+
/** Currently active input source: `'touch'` when at least one touch is active, otherwise `'mouse'` (or `'none'` when the cursor is off-canvas). */
|
|
917
917
|
type: 'mouse' | 'touch' | 'none';
|
|
918
918
|
}
|
|
919
919
|
|
|
@@ -1016,7 +1016,7 @@ declare global {
|
|
|
1016
1016
|
description?: string;
|
|
1017
1017
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1018
1018
|
group?: string;
|
|
1019
|
-
/** Visibility category
|
|
1019
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1020
1020
|
category?: ParameterCategory;
|
|
1021
1021
|
}
|
|
1022
1022
|
|
|
@@ -1035,7 +1035,7 @@ declare global {
|
|
|
1035
1035
|
description?: string;
|
|
1036
1036
|
/** Group name under which the control appears in the UI. */
|
|
1037
1037
|
group: string;
|
|
1038
|
-
/** Visibility category
|
|
1038
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1039
1039
|
category: ParameterCategory;
|
|
1040
1040
|
}
|
|
1041
1041
|
|
|
@@ -1056,7 +1056,7 @@ declare global {
|
|
|
1056
1056
|
description?: string;
|
|
1057
1057
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1058
1058
|
group?: string;
|
|
1059
|
-
/** Visibility category
|
|
1059
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1060
1060
|
category?: ParameterCategory;
|
|
1061
1061
|
}
|
|
1062
1062
|
|
|
@@ -1079,7 +1079,7 @@ declare global {
|
|
|
1079
1079
|
description?: string;
|
|
1080
1080
|
/** Group name under which the control appears in the UI. */
|
|
1081
1081
|
group: string;
|
|
1082
|
-
/** Visibility category
|
|
1082
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1083
1083
|
category: ParameterCategory;
|
|
1084
1084
|
}
|
|
1085
1085
|
|
|
@@ -1094,7 +1094,7 @@ declare global {
|
|
|
1094
1094
|
description?: string;
|
|
1095
1095
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1096
1096
|
group?: string;
|
|
1097
|
-
/** Visibility category
|
|
1097
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1098
1098
|
category?: ParameterCategory;
|
|
1099
1099
|
/** Maximum character count enforced by the host UI. Default: `1000`. */
|
|
1100
1100
|
maxLength?: number;
|
|
@@ -1115,7 +1115,7 @@ declare global {
|
|
|
1115
1115
|
description?: string;
|
|
1116
1116
|
/** Group name under which the control appears in the UI. */
|
|
1117
1117
|
group: string;
|
|
1118
|
-
/** Visibility category
|
|
1118
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1119
1119
|
category: ParameterCategory;
|
|
1120
1120
|
}
|
|
1121
1121
|
|
|
@@ -1130,7 +1130,7 @@ declare global {
|
|
|
1130
1130
|
description?: string;
|
|
1131
1131
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1132
1132
|
group?: string;
|
|
1133
|
-
/** Visibility category
|
|
1133
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1134
1134
|
category?: ParameterCategory;
|
|
1135
1135
|
}
|
|
1136
1136
|
|
|
@@ -1147,7 +1147,7 @@ declare global {
|
|
|
1147
1147
|
description?: string;
|
|
1148
1148
|
/** Group name under which the control appears in the UI. */
|
|
1149
1149
|
group: string;
|
|
1150
|
-
/** Visibility category
|
|
1150
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1151
1151
|
category: ParameterCategory;
|
|
1152
1152
|
}
|
|
1153
1153
|
|
|
@@ -1156,7 +1156,7 @@ declare global {
|
|
|
1156
1156
|
* `started` / `moved` / `ended` arrays for frame-based gesture handling.
|
|
1157
1157
|
*
|
|
1158
1158
|
* For single-point interactions that should also work with a mouse, prefer
|
|
1159
|
-
* `viji.pointer
|
|
1159
|
+
* `viji.pointer`. It switches automatically between mouse and primary touch.
|
|
1160
1160
|
*/
|
|
1161
1161
|
interface TouchAPI {
|
|
1162
1162
|
/** All currently active touch points. Order is stable but not ordered by id. */
|
|
@@ -1179,7 +1179,7 @@ declare global {
|
|
|
1179
1179
|
* in canvas-space pixels.
|
|
1180
1180
|
*
|
|
1181
1181
|
* Some fields (notably `pressure` / `force`, `radiusX` / `radiusY`,
|
|
1182
|
-
* `rotationAngle`) are passed through from the device
|
|
1182
|
+
* `rotationAngle`) are passed through from the device; values vary by
|
|
1183
1183
|
* platform; many devices report `0` when unsupported.
|
|
1184
1184
|
*/
|
|
1185
1185
|
interface TouchPoint {
|
|
@@ -1191,7 +1191,7 @@ declare global {
|
|
|
1191
1191
|
y: number;
|
|
1192
1192
|
/** Touch pressure in 0..1 (device-dependent; often `0` on devices without force support). */
|
|
1193
1193
|
pressure: number;
|
|
1194
|
-
/** Contact radius
|
|
1194
|
+
/** Contact radius, `Math.max(radiusX, radiusY)` in pixels. */
|
|
1195
1195
|
radius: number;
|
|
1196
1196
|
/** Horizontal contact radius in pixels (raw device value). */
|
|
1197
1197
|
radiusX: number;
|
|
@@ -1199,7 +1199,7 @@ declare global {
|
|
|
1199
1199
|
radiusY: number;
|
|
1200
1200
|
/** Contact area rotation in radians (raw device value). */
|
|
1201
1201
|
rotationAngle: number;
|
|
1202
|
-
/** Touch force in 0..1
|
|
1202
|
+
/** Touch force in 0..1; alias of `pressure`. */
|
|
1203
1203
|
force: number;
|
|
1204
1204
|
/** `true` while the touch position is within the canvas bounds. */
|
|
1205
1205
|
isInCanvas: boolean;
|
|
@@ -1222,7 +1222,7 @@ declare global {
|
|
|
1222
1222
|
isEnding: boolean;
|
|
1223
1223
|
}
|
|
1224
1224
|
|
|
1225
|
-
const VERSION = "0.4.
|
|
1225
|
+
const VERSION = "0.4.1";
|
|
1226
1226
|
|
|
1227
1227
|
/**
|
|
1228
1228
|
* Real-time video API: drawable frame, dimensions, and computer-vision results
|
|
@@ -1244,7 +1244,7 @@ declare global {
|
|
|
1244
1244
|
frameRate: number;
|
|
1245
1245
|
/**
|
|
1246
1246
|
* Returns the latest frame as raw RGBA `ImageData` for per-pixel CPU analysis,
|
|
1247
|
-
* or `null` when disconnected. Slow compared to drawing `currentFrame` directly
|
|
1247
|
+
* or `null` when disconnected. Slow compared to drawing `currentFrame` directly;
|
|
1248
1248
|
* use only when you need to read individual pixel values.
|
|
1249
1249
|
*/
|
|
1250
1250
|
getFrameData: () => ImageData | null;
|
|
@@ -1315,13 +1315,13 @@ declare global {
|
|
|
1315
1315
|
ctx?: OffscreenCanvasRenderingContext2D;
|
|
1316
1316
|
/** WebGL rendering context. `undefined` until `viji.useContext('webgl')` or `'webgl2'` is called; afterwards equals the cached context. */
|
|
1317
1317
|
gl?: WebGLRenderingContext | WebGL2RenderingContext;
|
|
1318
|
-
/** Current canvas width in pixels. Updates automatically when the host resizes the canvas
|
|
1318
|
+
/** Current canvas width in pixels. Updates automatically when the host resizes the canvas; read every frame. */
|
|
1319
1319
|
width: number;
|
|
1320
|
-
/** Current canvas height in pixels. Updates automatically when the host resizes the canvas
|
|
1320
|
+
/** Current canvas height in pixels. Updates automatically when the host resizes the canvas; read every frame. */
|
|
1321
1321
|
height: number;
|
|
1322
1322
|
/** Seconds elapsed since the scene started (monotonically increasing float). Use for oscillations and absolute-time effects. */
|
|
1323
1323
|
time: number;
|
|
1324
|
-
/** Seconds since the previous frame. Use for accumulation: movement, physics, fades
|
|
1324
|
+
/** Seconds since the previous frame. Use for accumulation: movement, physics, fades, anything that should progress per second regardless of FPS. */
|
|
1325
1325
|
deltaTime: number;
|
|
1326
1326
|
/** Integer frame counter starting at `0` and incrementing by `1` each frame. */
|
|
1327
1327
|
frameCount: number;
|
|
@@ -1331,9 +1331,9 @@ declare global {
|
|
|
1331
1331
|
audio: AudioAPI;
|
|
1332
1332
|
/** Main video stream API: pixel access, frame metadata, and computer-vision results (face, hands, pose, segmentation). */
|
|
1333
1333
|
video: VideoAPI;
|
|
1334
|
-
/** Additional video streams provided by the host. These do not run CV processing
|
|
1334
|
+
/** Additional video streams provided by the host. These do not run CV processing; use them for raw pixel access only. */
|
|
1335
1335
|
videoStreams: VideoAPI[];
|
|
1336
|
-
/** Additional audio streams (lightweight analysis: volume, bands, spectral). No beat detection
|
|
1336
|
+
/** Additional audio streams (lightweight analysis: volume, bands, spectral). No beat detection; use the main `audio` for that. */
|
|
1337
1337
|
audioStreams: AudioStreamAPI[];
|
|
1338
1338
|
/** Mouse position, buttons, wheel, and per-frame movement state. Coordinates are in canvas pixels. */
|
|
1339
1339
|
mouse: MouseAPI;
|
|
@@ -1341,7 +1341,7 @@ declare global {
|
|
|
1341
1341
|
keyboard: KeyboardAPI;
|
|
1342
1342
|
/** Multi-touch state: count, primary touch shortcut, and the per-frame `started` / `moved` / `ended` arrays. */
|
|
1343
1343
|
touches: TouchAPI;
|
|
1344
|
-
/** Unified pointer (mouse + primary touch)
|
|
1344
|
+
/** Unified pointer (mouse + primary touch). Convenient single-point input that works on both desktop and mobile. */
|
|
1345
1345
|
pointer: PointerAPI;
|
|
1346
1346
|
/** Internal device sensors (motion + orientation) reported by the device running the scene. */
|
|
1347
1347
|
device: DeviceSensorState;
|
|
@@ -1349,7 +1349,7 @@ declare global {
|
|
|
1349
1349
|
devices: DeviceState[];
|
|
1350
1350
|
/**
|
|
1351
1351
|
* Declares a numeric slider parameter. The host UI renders a draggable slider.
|
|
1352
|
-
* Must be called at the top level of the scene
|
|
1352
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1353
1353
|
*
|
|
1354
1354
|
* @example
|
|
1355
1355
|
* const radius = viji.slider(50, { min: 10, max: 200, step: 1, label: 'Radius' });
|
|
@@ -1360,7 +1360,7 @@ declare global {
|
|
|
1360
1360
|
/**
|
|
1361
1361
|
* Declares a color parameter. Accepts hex strings, CSS color functions, or RGB / HSB objects;
|
|
1362
1362
|
* the value is always normalized to a canonical lowercase hex string and exposes derived `.rgb` / `.hsb` accessors.
|
|
1363
|
-
* Must be called at the top level of the scene
|
|
1363
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1364
1364
|
*
|
|
1365
1365
|
* @example
|
|
1366
1366
|
* const tint = viji.color('#ff6600', { label: 'Tint' });
|
|
@@ -1369,7 +1369,7 @@ declare global {
|
|
|
1369
1369
|
color: (defaultValue: ColorInput, config: ColorConfig) => ColorParameter;
|
|
1370
1370
|
/**
|
|
1371
1371
|
* Declares a boolean toggle parameter. The host UI renders an on/off switch.
|
|
1372
|
-
* Must be called at the top level of the scene
|
|
1372
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1373
1373
|
*
|
|
1374
1374
|
* @example
|
|
1375
1375
|
* const showTrail = viji.toggle(true, { label: 'Show Trail' });
|
|
@@ -1378,7 +1378,7 @@ declare global {
|
|
|
1378
1378
|
/**
|
|
1379
1379
|
* Declares a dropdown selection parameter. The element type of `options`
|
|
1380
1380
|
* (`string` or `number`) determines the parameter's value type.
|
|
1381
|
-
* Must be called at the top level of the scene
|
|
1381
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1382
1382
|
*
|
|
1383
1383
|
* @example
|
|
1384
1384
|
* const shape = viji.select('circle', { options: ['circle', 'square', 'triangle'], label: 'Shape' });
|
|
@@ -1386,7 +1386,7 @@ declare global {
|
|
|
1386
1386
|
select: (defaultValue: string | number, config: SelectConfig) => SelectParameter;
|
|
1387
1387
|
/**
|
|
1388
1388
|
* Declares a text input parameter. The host UI renders a single-line text field.
|
|
1389
|
-
* Must be called at the top level of the scene
|
|
1389
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1390
1390
|
*
|
|
1391
1391
|
* @example
|
|
1392
1392
|
* const caption = viji.text('Hello', { label: 'Caption', maxLength: 64 });
|
|
@@ -1395,7 +1395,7 @@ declare global {
|
|
|
1395
1395
|
/**
|
|
1396
1396
|
* Declares a precise numeric input parameter. Like `slider()` but the host UI
|
|
1397
1397
|
* shows a number field instead of a draggable handle.
|
|
1398
|
-
* Must be called at the top level of the scene
|
|
1398
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1399
1399
|
*
|
|
1400
1400
|
* @example
|
|
1401
1401
|
* const count = viji.number(12, { min: 1, max: 64, step: 1, label: 'Count' });
|
|
@@ -1404,7 +1404,7 @@ declare global {
|
|
|
1404
1404
|
/**
|
|
1405
1405
|
* Declares an image upload parameter. The user-supplied image becomes available
|
|
1406
1406
|
* as `value` (an `ImageBitmap`); in P5 scenes a `.p5` accessor is also added at runtime.
|
|
1407
|
-
* Must be called at the top level of the scene
|
|
1407
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1408
1408
|
*
|
|
1409
1409
|
* @example
|
|
1410
1410
|
* const tex = viji.image(null, { label: 'Texture' });
|
|
@@ -1413,8 +1413,8 @@ declare global {
|
|
|
1413
1413
|
image: (defaultValue: null, config: ImageConfig) => ImageParameter;
|
|
1414
1414
|
/**
|
|
1415
1415
|
* Declares a momentary button parameter. `value` is `true` for one frame after
|
|
1416
|
-
* the user clicks, then auto-resets
|
|
1417
|
-
* Must be called at the top level of the scene
|
|
1416
|
+
* the user clicks, then auto-resets. Perfect for triggering discrete events.
|
|
1417
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1418
1418
|
*
|
|
1419
1419
|
* @example
|
|
1420
1420
|
* const reset = viji.button({ label: 'Reset' });
|
|
@@ -1423,7 +1423,7 @@ declare global {
|
|
|
1423
1423
|
button: (config: ButtonConfig) => ButtonParameter;
|
|
1424
1424
|
/**
|
|
1425
1425
|
* Declares a 2D coordinate parameter. Both `value.x` and `value.y` are in `-1..1`.
|
|
1426
|
-
* Must be called at the top level of the scene
|
|
1426
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1427
1427
|
*
|
|
1428
1428
|
* @example
|
|
1429
1429
|
* const origin = viji.coordinate({ x: 0, y: 0 }, { label: 'Origin' });
|
|
@@ -1433,7 +1433,7 @@ declare global {
|
|
|
1433
1433
|
/**
|
|
1434
1434
|
* Selects the 2D canvas rendering context. Returns the same instance on
|
|
1435
1435
|
* subsequent calls and also stores it on `viji.ctx`. A canvas only supports
|
|
1436
|
-
* one context type
|
|
1436
|
+
* one context type. If a different context type was already requested,
|
|
1437
1437
|
* the call returns `null`. Choose ONE type and use it for the entire scene.
|
|
1438
1438
|
*
|
|
1439
1439
|
* @example
|
|
@@ -1444,14 +1444,14 @@ declare global {
|
|
|
1444
1444
|
/**
|
|
1445
1445
|
* Selects a WebGL 1 rendering context. Returns the same instance on subsequent
|
|
1446
1446
|
* calls and also stores it on `viji.gl`. A canvas only supports one context
|
|
1447
|
-
* type
|
|
1447
|
+
* type. If a different context type was already requested, the call returns
|
|
1448
1448
|
* `null`. Choose ONE type and use it for the entire scene.
|
|
1449
1449
|
*/
|
|
1450
1450
|
useContext(type: 'webgl'): WebGLRenderingContext;
|
|
1451
1451
|
/**
|
|
1452
1452
|
* Selects a WebGL 2 rendering context. Returns the same instance on subsequent
|
|
1453
1453
|
* calls and also stores it on `viji.gl`. A canvas only supports one context
|
|
1454
|
-
* type
|
|
1454
|
+
* type. If a different context type was already requested, the call returns
|
|
1455
1455
|
* `null`. Choose ONE type and use it for the entire scene.
|
|
1456
1456
|
*/
|
|
1457
1457
|
useContext(type: 'webgl2'): WebGL2RenderingContext;
|