@viji-dev/core 0.4.1 → 0.4.3
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/assets/{viji.worker-4gGFik2A.js → viji.worker-DiQyLnqS.js} +171 -96
- package/dist/assets/viji.worker-DiQyLnqS.js.map +1 -0
- package/dist/docs-api.js +9704 -9632
- package/dist/{essentia-wasm.web-CCpzl5zi.js → essentia-wasm.web-CpSS-HV6.js} +2 -2
- package/dist/{essentia-wasm.web-CCpzl5zi.js.map → essentia-wasm.web-CpSS-HV6.js.map} +1 -1
- package/dist/{index-G2N9Tgtd.js → index-BlVguPnk.js} +747 -6901
- package/dist/index-BlVguPnk.js.map +1 -0
- package/dist/index.d.ts +78 -71
- package/dist/index.js +1 -1
- package/package.json +97 -98
- package/dist/assets/viji.worker-4gGFik2A.js.map +0 -1
- package/dist/index-G2N9Tgtd.js.map +0 -1
package/dist/artist-global.d.ts
CHANGED
|
@@ -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
|
|
|
@@ -843,7 +843,7 @@ declare global {
|
|
|
843
843
|
description?: string;
|
|
844
844
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
845
845
|
group?: string;
|
|
846
|
-
/** Visibility category
|
|
846
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
847
847
|
category?: ParameterCategory;
|
|
848
848
|
}
|
|
849
849
|
|
|
@@ -866,7 +866,7 @@ declare global {
|
|
|
866
866
|
description?: string;
|
|
867
867
|
/** Group name under which the control appears in the UI. */
|
|
868
868
|
group: string;
|
|
869
|
-
/** Visibility category
|
|
869
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
870
870
|
category: ParameterCategory;
|
|
871
871
|
}
|
|
872
872
|
|
|
@@ -894,7 +894,7 @@ declare global {
|
|
|
894
894
|
deltaX: number;
|
|
895
895
|
/** Vertical movement since the last frame in pixels. */
|
|
896
896
|
deltaY: number;
|
|
897
|
-
/** `true` while the pointer is "down"
|
|
897
|
+
/** `true` while the pointer is "down": left mouse button held, or a touch active. */
|
|
898
898
|
isDown: boolean;
|
|
899
899
|
/** `true` for exactly one frame when the pointer becomes down, then auto-resets. */
|
|
900
900
|
wasPressed: boolean;
|
|
@@ -902,7 +902,7 @@ declare global {
|
|
|
902
902
|
wasReleased: boolean;
|
|
903
903
|
/** `true` while the pointer is within the canvas bounds. */
|
|
904
904
|
isInCanvas: boolean;
|
|
905
|
-
/** Currently active input source
|
|
905
|
+
/** Currently active input source: `'touch'` when at least one touch is active, otherwise `'mouse'` (or `'none'` when the cursor is off-canvas). */
|
|
906
906
|
type: 'mouse' | 'touch' | 'none';
|
|
907
907
|
}
|
|
908
908
|
|
|
@@ -1005,7 +1005,7 @@ declare global {
|
|
|
1005
1005
|
description?: string;
|
|
1006
1006
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1007
1007
|
group?: string;
|
|
1008
|
-
/** Visibility category
|
|
1008
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1009
1009
|
category?: ParameterCategory;
|
|
1010
1010
|
}
|
|
1011
1011
|
|
|
@@ -1024,7 +1024,7 @@ declare global {
|
|
|
1024
1024
|
description?: string;
|
|
1025
1025
|
/** Group name under which the control appears in the UI. */
|
|
1026
1026
|
group: string;
|
|
1027
|
-
/** Visibility category
|
|
1027
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1028
1028
|
category: ParameterCategory;
|
|
1029
1029
|
}
|
|
1030
1030
|
|
|
@@ -1045,7 +1045,7 @@ declare global {
|
|
|
1045
1045
|
description?: string;
|
|
1046
1046
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1047
1047
|
group?: string;
|
|
1048
|
-
/** Visibility category
|
|
1048
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1049
1049
|
category?: ParameterCategory;
|
|
1050
1050
|
}
|
|
1051
1051
|
|
|
@@ -1068,7 +1068,7 @@ declare global {
|
|
|
1068
1068
|
description?: string;
|
|
1069
1069
|
/** Group name under which the control appears in the UI. */
|
|
1070
1070
|
group: string;
|
|
1071
|
-
/** Visibility category
|
|
1071
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1072
1072
|
category: ParameterCategory;
|
|
1073
1073
|
}
|
|
1074
1074
|
|
|
@@ -1083,7 +1083,7 @@ declare global {
|
|
|
1083
1083
|
description?: string;
|
|
1084
1084
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1085
1085
|
group?: string;
|
|
1086
|
-
/** Visibility category
|
|
1086
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1087
1087
|
category?: ParameterCategory;
|
|
1088
1088
|
/** Maximum character count enforced by the host UI. Default: `1000`. */
|
|
1089
1089
|
maxLength?: number;
|
|
@@ -1104,7 +1104,7 @@ declare global {
|
|
|
1104
1104
|
description?: string;
|
|
1105
1105
|
/** Group name under which the control appears in the UI. */
|
|
1106
1106
|
group: string;
|
|
1107
|
-
/** Visibility category
|
|
1107
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1108
1108
|
category: ParameterCategory;
|
|
1109
1109
|
}
|
|
1110
1110
|
|
|
@@ -1119,7 +1119,7 @@ declare global {
|
|
|
1119
1119
|
description?: string;
|
|
1120
1120
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1121
1121
|
group?: string;
|
|
1122
|
-
/** Visibility category
|
|
1122
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1123
1123
|
category?: ParameterCategory;
|
|
1124
1124
|
}
|
|
1125
1125
|
|
|
@@ -1136,7 +1136,7 @@ declare global {
|
|
|
1136
1136
|
description?: string;
|
|
1137
1137
|
/** Group name under which the control appears in the UI. */
|
|
1138
1138
|
group: string;
|
|
1139
|
-
/** Visibility category
|
|
1139
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1140
1140
|
category: ParameterCategory;
|
|
1141
1141
|
}
|
|
1142
1142
|
|
|
@@ -1145,7 +1145,7 @@ declare global {
|
|
|
1145
1145
|
* `started` / `moved` / `ended` arrays for frame-based gesture handling.
|
|
1146
1146
|
*
|
|
1147
1147
|
* For single-point interactions that should also work with a mouse, prefer
|
|
1148
|
-
* `viji.pointer
|
|
1148
|
+
* `viji.pointer`. It switches automatically between mouse and primary touch.
|
|
1149
1149
|
*/
|
|
1150
1150
|
interface TouchAPI {
|
|
1151
1151
|
/** All currently active touch points. Order is stable but not ordered by id. */
|
|
@@ -1168,7 +1168,7 @@ declare global {
|
|
|
1168
1168
|
* in canvas-space pixels.
|
|
1169
1169
|
*
|
|
1170
1170
|
* Some fields (notably `pressure` / `force`, `radiusX` / `radiusY`,
|
|
1171
|
-
* `rotationAngle`) are passed through from the device
|
|
1171
|
+
* `rotationAngle`) are passed through from the device; values vary by
|
|
1172
1172
|
* platform; many devices report `0` when unsupported.
|
|
1173
1173
|
*/
|
|
1174
1174
|
interface TouchPoint {
|
|
@@ -1180,7 +1180,7 @@ declare global {
|
|
|
1180
1180
|
y: number;
|
|
1181
1181
|
/** Touch pressure in 0..1 (device-dependent; often `0` on devices without force support). */
|
|
1182
1182
|
pressure: number;
|
|
1183
|
-
/** Contact radius
|
|
1183
|
+
/** Contact radius, `Math.max(radiusX, radiusY)` in pixels. */
|
|
1184
1184
|
radius: number;
|
|
1185
1185
|
/** Horizontal contact radius in pixels (raw device value). */
|
|
1186
1186
|
radiusX: number;
|
|
@@ -1188,7 +1188,7 @@ declare global {
|
|
|
1188
1188
|
radiusY: number;
|
|
1189
1189
|
/** Contact area rotation in radians (raw device value). */
|
|
1190
1190
|
rotationAngle: number;
|
|
1191
|
-
/** Touch force in 0..1
|
|
1191
|
+
/** Touch force in 0..1; alias of `pressure`. */
|
|
1192
1192
|
force: number;
|
|
1193
1193
|
/** `true` while the touch position is within the canvas bounds. */
|
|
1194
1194
|
isInCanvas: boolean;
|
|
@@ -1211,7 +1211,7 @@ declare global {
|
|
|
1211
1211
|
isEnding: boolean;
|
|
1212
1212
|
}
|
|
1213
1213
|
|
|
1214
|
-
const VERSION = "0.4.
|
|
1214
|
+
const VERSION = "0.4.2";
|
|
1215
1215
|
|
|
1216
1216
|
/**
|
|
1217
1217
|
* Real-time video API: drawable frame, dimensions, and computer-vision results
|
|
@@ -1233,7 +1233,7 @@ declare global {
|
|
|
1233
1233
|
frameRate: number;
|
|
1234
1234
|
/**
|
|
1235
1235
|
* Returns the latest frame as raw RGBA `ImageData` for per-pixel CPU analysis,
|
|
1236
|
-
* or `null` when disconnected. Slow compared to drawing `currentFrame` directly
|
|
1236
|
+
* or `null` when disconnected. Slow compared to drawing `currentFrame` directly;
|
|
1237
1237
|
* use only when you need to read individual pixel values.
|
|
1238
1238
|
*/
|
|
1239
1239
|
getFrameData: () => ImageData | null;
|
|
@@ -1304,13 +1304,13 @@ declare global {
|
|
|
1304
1304
|
ctx?: OffscreenCanvasRenderingContext2D;
|
|
1305
1305
|
/** WebGL rendering context. `undefined` until `viji.useContext('webgl')` or `'webgl2'` is called; afterwards equals the cached context. */
|
|
1306
1306
|
gl?: WebGLRenderingContext | WebGL2RenderingContext;
|
|
1307
|
-
/** Current canvas width in pixels. Updates automatically when the host resizes the canvas
|
|
1307
|
+
/** Current canvas width in pixels. Updates automatically when the host resizes the canvas; read every frame. */
|
|
1308
1308
|
width: number;
|
|
1309
|
-
/** Current canvas height in pixels. Updates automatically when the host resizes the canvas
|
|
1309
|
+
/** Current canvas height in pixels. Updates automatically when the host resizes the canvas; read every frame. */
|
|
1310
1310
|
height: number;
|
|
1311
1311
|
/** Seconds elapsed since the scene started (monotonically increasing float). Use for oscillations and absolute-time effects. */
|
|
1312
1312
|
time: number;
|
|
1313
|
-
/** Seconds since the previous frame. Use for accumulation: movement, physics, fades
|
|
1313
|
+
/** Seconds since the previous frame. Use for accumulation: movement, physics, fades, anything that should progress per second regardless of FPS. */
|
|
1314
1314
|
deltaTime: number;
|
|
1315
1315
|
/** Integer frame counter starting at `0` and incrementing by `1` each frame. */
|
|
1316
1316
|
frameCount: number;
|
|
@@ -1320,9 +1320,9 @@ declare global {
|
|
|
1320
1320
|
audio: AudioAPI;
|
|
1321
1321
|
/** Main video stream API: pixel access, frame metadata, and computer-vision results (face, hands, pose, segmentation). */
|
|
1322
1322
|
video: VideoAPI;
|
|
1323
|
-
/** Additional video streams provided by the host. These do not run CV processing
|
|
1323
|
+
/** Additional video streams provided by the host. These do not run CV processing; use them for raw pixel access only. */
|
|
1324
1324
|
videoStreams: VideoAPI[];
|
|
1325
|
-
/** Additional audio streams (lightweight analysis: volume, bands, spectral). No beat detection
|
|
1325
|
+
/** Additional audio streams (lightweight analysis: volume, bands, spectral). No beat detection; use the main `audio` for that. */
|
|
1326
1326
|
audioStreams: AudioStreamAPI[];
|
|
1327
1327
|
/** Mouse position, buttons, wheel, and per-frame movement state. Coordinates are in canvas pixels. */
|
|
1328
1328
|
mouse: MouseAPI;
|
|
@@ -1330,7 +1330,7 @@ declare global {
|
|
|
1330
1330
|
keyboard: KeyboardAPI;
|
|
1331
1331
|
/** Multi-touch state: count, primary touch shortcut, and the per-frame `started` / `moved` / `ended` arrays. */
|
|
1332
1332
|
touches: TouchAPI;
|
|
1333
|
-
/** Unified pointer (mouse + primary touch)
|
|
1333
|
+
/** Unified pointer (mouse + primary touch). Convenient single-point input that works on both desktop and mobile. */
|
|
1334
1334
|
pointer: PointerAPI;
|
|
1335
1335
|
/** Internal device sensors (motion + orientation) reported by the device running the scene. */
|
|
1336
1336
|
device: DeviceSensorState;
|
|
@@ -1338,7 +1338,7 @@ declare global {
|
|
|
1338
1338
|
devices: DeviceState[];
|
|
1339
1339
|
/**
|
|
1340
1340
|
* Declares a numeric slider parameter. The host UI renders a draggable slider.
|
|
1341
|
-
* Must be called at the top level of the scene
|
|
1341
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1342
1342
|
*
|
|
1343
1343
|
* @example
|
|
1344
1344
|
* const radius = viji.slider(50, { min: 10, max: 200, step: 1, label: 'Radius' });
|
|
@@ -1349,7 +1349,7 @@ declare global {
|
|
|
1349
1349
|
/**
|
|
1350
1350
|
* Declares a color parameter. Accepts hex strings, CSS color functions, or RGB / HSB objects;
|
|
1351
1351
|
* the value is always normalized to a canonical lowercase hex string and exposes derived `.rgb` / `.hsb` accessors.
|
|
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 tint = viji.color('#ff6600', { label: 'Tint' });
|
|
@@ -1358,7 +1358,7 @@ declare global {
|
|
|
1358
1358
|
color: (defaultValue: ColorInput, config: ColorConfig) => ColorParameter;
|
|
1359
1359
|
/**
|
|
1360
1360
|
* Declares a boolean toggle parameter. The host UI renders an on/off switch.
|
|
1361
|
-
* Must be called at the top level of the scene
|
|
1361
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1362
1362
|
*
|
|
1363
1363
|
* @example
|
|
1364
1364
|
* const showTrail = viji.toggle(true, { label: 'Show Trail' });
|
|
@@ -1367,7 +1367,7 @@ declare global {
|
|
|
1367
1367
|
/**
|
|
1368
1368
|
* Declares a dropdown selection parameter. The element type of `options`
|
|
1369
1369
|
* (`string` or `number`) determines the parameter's value type.
|
|
1370
|
-
* Must be called at the top level of the scene
|
|
1370
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1371
1371
|
*
|
|
1372
1372
|
* @example
|
|
1373
1373
|
* const shape = viji.select('circle', { options: ['circle', 'square', 'triangle'], label: 'Shape' });
|
|
@@ -1375,7 +1375,7 @@ declare global {
|
|
|
1375
1375
|
select: (defaultValue: string | number, config: SelectConfig) => SelectParameter;
|
|
1376
1376
|
/**
|
|
1377
1377
|
* Declares a text input parameter. The host UI renders a single-line text field.
|
|
1378
|
-
* Must be called at the top level of the scene
|
|
1378
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1379
1379
|
*
|
|
1380
1380
|
* @example
|
|
1381
1381
|
* const caption = viji.text('Hello', { label: 'Caption', maxLength: 64 });
|
|
@@ -1384,7 +1384,7 @@ declare global {
|
|
|
1384
1384
|
/**
|
|
1385
1385
|
* Declares a precise numeric input parameter. Like `slider()` but the host UI
|
|
1386
1386
|
* shows a number field instead of a draggable handle.
|
|
1387
|
-
* Must be called at the top level of the scene
|
|
1387
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1388
1388
|
*
|
|
1389
1389
|
* @example
|
|
1390
1390
|
* const count = viji.number(12, { min: 1, max: 64, step: 1, label: 'Count' });
|
|
@@ -1393,7 +1393,7 @@ declare global {
|
|
|
1393
1393
|
/**
|
|
1394
1394
|
* Declares an image upload parameter. The user-supplied image becomes available
|
|
1395
1395
|
* as `value` (an `ImageBitmap`); in P5 scenes a `.p5` accessor is also added at runtime.
|
|
1396
|
-
* Must be called at the top level of the scene
|
|
1396
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1397
1397
|
*
|
|
1398
1398
|
* @example
|
|
1399
1399
|
* const tex = viji.image(null, { label: 'Texture' });
|
|
@@ -1402,8 +1402,8 @@ declare global {
|
|
|
1402
1402
|
image: (defaultValue: null, config: ImageConfig) => ImageParameter;
|
|
1403
1403
|
/**
|
|
1404
1404
|
* Declares a momentary button parameter. `value` is `true` for one frame after
|
|
1405
|
-
* the user clicks, then auto-resets
|
|
1406
|
-
* Must be called at the top level of the scene
|
|
1405
|
+
* the user clicks, then auto-resets. Perfect for triggering discrete events.
|
|
1406
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1407
1407
|
*
|
|
1408
1408
|
* @example
|
|
1409
1409
|
* const reset = viji.button({ label: 'Reset' });
|
|
@@ -1412,7 +1412,7 @@ declare global {
|
|
|
1412
1412
|
button: (config: ButtonConfig) => ButtonParameter;
|
|
1413
1413
|
/**
|
|
1414
1414
|
* Declares a 2D coordinate parameter. Both `value.x` and `value.y` are in `-1..1`.
|
|
1415
|
-
* Must be called at the top level of the scene
|
|
1415
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
1416
1416
|
*
|
|
1417
1417
|
* @example
|
|
1418
1418
|
* const origin = viji.coordinate({ x: 0, y: 0 }, { label: 'Origin' });
|
|
@@ -1422,7 +1422,7 @@ declare global {
|
|
|
1422
1422
|
/**
|
|
1423
1423
|
* Selects the 2D canvas rendering context. Returns the same instance on
|
|
1424
1424
|
* subsequent calls and also stores it on `viji.ctx`. A canvas only supports
|
|
1425
|
-
* one context type
|
|
1425
|
+
* one context type. If a different context type was already requested,
|
|
1426
1426
|
* the call returns `null`. Choose ONE type and use it for the entire scene.
|
|
1427
1427
|
*
|
|
1428
1428
|
* @example
|
|
@@ -1433,14 +1433,14 @@ declare global {
|
|
|
1433
1433
|
/**
|
|
1434
1434
|
* Selects a WebGL 1 rendering context. Returns the same instance on subsequent
|
|
1435
1435
|
* calls and also stores it on `viji.gl`. A canvas only supports one context
|
|
1436
|
-
* type
|
|
1436
|
+
* type. If a different context type was already requested, the call returns
|
|
1437
1437
|
* `null`. Choose ONE type and use it for the entire scene.
|
|
1438
1438
|
*/
|
|
1439
1439
|
useContext(type: 'webgl'): WebGLRenderingContext;
|
|
1440
1440
|
/**
|
|
1441
1441
|
* Selects a WebGL 2 rendering context. Returns the same instance on subsequent
|
|
1442
1442
|
* calls and also stores it on `viji.gl`. A canvas only supports one context
|
|
1443
|
-
* type
|
|
1443
|
+
* type. If a different context type was already requested, the call returns
|
|
1444
1444
|
* `null`. Choose ONE type and use it for the entire scene.
|
|
1445
1445
|
*/
|
|
1446
1446
|
useContext(type: 'webgl2'): WebGL2RenderingContext;
|