@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
package/dist/index.d.ts
CHANGED
|
@@ -32,15 +32,15 @@ export declare interface AudioAPI {
|
|
|
32
32
|
};
|
|
33
33
|
/** Energy in five fixed frequency bands, plus a smoothed companion (~150ms decay) for each. All in 0..1. */
|
|
34
34
|
bands: {
|
|
35
|
-
/** Instant low-band energy (20
|
|
35
|
+
/** Instant low-band energy (20-120 Hz, bass/kick range). 0..1. */
|
|
36
36
|
low: number;
|
|
37
|
-
/** Instant low-mid energy (120
|
|
37
|
+
/** Instant low-mid energy (120-400 Hz). 0..1. */
|
|
38
38
|
lowMid: number;
|
|
39
|
-
/** Instant mid energy (400
|
|
39
|
+
/** Instant mid energy (400-1600 Hz, vocals/instruments). 0..1. */
|
|
40
40
|
mid: number;
|
|
41
|
-
/** Instant high-mid energy (1600
|
|
41
|
+
/** Instant high-mid energy (1600-6000 Hz, cymbals/hi-hats). 0..1. */
|
|
42
42
|
highMid: number;
|
|
43
|
-
/** Instant high-band energy (6000
|
|
43
|
+
/** Instant high-band energy (6000-16000 Hz, air/brilliance). 0..1. */
|
|
44
44
|
high: number;
|
|
45
45
|
/** Smoothed `low` (~150ms decay). 0..1. */
|
|
46
46
|
lowSmoothed: number;
|
|
@@ -100,15 +100,15 @@ export declare interface AudioAPI {
|
|
|
100
100
|
};
|
|
101
101
|
/** High-level spectral features derived from the FFT. */
|
|
102
102
|
spectral: {
|
|
103
|
-
/** Normalized spectral centroid in 0..1
|
|
103
|
+
/** Normalized spectral centroid in 0..1. Higher values mean brighter, more treble-heavy sound. */
|
|
104
104
|
brightness: number;
|
|
105
|
-
/** Normalized spectral flatness in 0..1
|
|
105
|
+
/** Normalized spectral flatness in 0..1. Higher values mean noisier (white-noise-like) sound; lower values mean tonal. */
|
|
106
106
|
flatness: number;
|
|
107
107
|
};
|
|
108
108
|
/**
|
|
109
109
|
* Returns the raw FFT magnitude spectrum as a `Uint8Array` (1024 bins, each 0..255).
|
|
110
110
|
* Bin `i` covers frequency `i × (sampleRate / fftSize)`. The returned array is a
|
|
111
|
-
* snapshot from the latest analysis tick
|
|
111
|
+
* snapshot from the latest analysis tick; repeated calls in the same frame return the same data.
|
|
112
112
|
*
|
|
113
113
|
* @example
|
|
114
114
|
* const fft = viji.audio.getFrequencyData();
|
|
@@ -117,7 +117,7 @@ export declare interface AudioAPI {
|
|
|
117
117
|
getFrequencyData: () => Uint8Array;
|
|
118
118
|
/**
|
|
119
119
|
* Returns the raw time-domain waveform as a `Float32Array` (2048 PCM samples in -1..1).
|
|
120
|
-
* The returned array is a snapshot
|
|
120
|
+
* The returned array is a snapshot; repeated calls in the same frame return the same data.
|
|
121
121
|
*
|
|
122
122
|
* @example
|
|
123
123
|
* const wave = viji.audio.getWaveform();
|
|
@@ -128,7 +128,7 @@ export declare interface AudioAPI {
|
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* Lightweight audio analysis for additional or device audio streams. A strict
|
|
131
|
-
* subset of `AudioAPI`
|
|
131
|
+
* subset of `AudioAPI` that exposes volume, frequency bands, spectral features,
|
|
132
132
|
* and raw FFT/waveform access, but **no beat detection** (no `beat`, no BPM,
|
|
133
133
|
* no triggers, no events).
|
|
134
134
|
*/
|
|
@@ -146,15 +146,15 @@ declare interface AudioStreamAPI {
|
|
|
146
146
|
};
|
|
147
147
|
/** Energy in five fixed frequency bands, plus a smoothed companion (~150ms decay) for each. All in 0..1. */
|
|
148
148
|
bands: {
|
|
149
|
-
/** Instant low-band energy (20
|
|
149
|
+
/** Instant low-band energy (20-120 Hz). 0..1. */
|
|
150
150
|
low: number;
|
|
151
|
-
/** Instant low-mid energy (120
|
|
151
|
+
/** Instant low-mid energy (120-400 Hz). 0..1. */
|
|
152
152
|
lowMid: number;
|
|
153
|
-
/** Instant mid energy (400
|
|
153
|
+
/** Instant mid energy (400-1600 Hz). 0..1. */
|
|
154
154
|
mid: number;
|
|
155
|
-
/** Instant high-mid energy (1600
|
|
155
|
+
/** Instant high-mid energy (1600-6000 Hz). 0..1. */
|
|
156
156
|
highMid: number;
|
|
157
|
-
/** Instant high-band energy (6000
|
|
157
|
+
/** Instant high-band energy (6000-16000 Hz). 0..1. */
|
|
158
158
|
high: number;
|
|
159
159
|
/** Smoothed `low` (~150ms decay). 0..1. */
|
|
160
160
|
lowSmoothed: number;
|
|
@@ -176,12 +176,12 @@ declare interface AudioStreamAPI {
|
|
|
176
176
|
};
|
|
177
177
|
/**
|
|
178
178
|
* Returns the raw FFT magnitude spectrum for this stream as a `Uint8Array`
|
|
179
|
-
* (1024 bins, each 0..255). Snapshot semantics
|
|
179
|
+
* (1024 bins, each 0..255). Snapshot semantics; see `AudioAPI.getFrequencyData`.
|
|
180
180
|
*/
|
|
181
181
|
getFrequencyData: () => Uint8Array;
|
|
182
182
|
/**
|
|
183
183
|
* Returns the raw time-domain waveform for this stream as a `Float32Array`
|
|
184
|
-
* (2048 samples, each -1..1). Snapshot semantics
|
|
184
|
+
* (2048 samples, each -1..1). Snapshot semantics; see `AudioAPI.getWaveform`.
|
|
185
185
|
*/
|
|
186
186
|
getWaveform: () => Float32Array;
|
|
187
187
|
}
|
|
@@ -675,7 +675,7 @@ declare interface BeatEvent {
|
|
|
675
675
|
|
|
676
676
|
/**
|
|
677
677
|
* Configuration object passed to `viji.button()`. The host renders a clickable
|
|
678
|
-
* momentary button
|
|
678
|
+
* momentary button. The resulting `value` is `true` for one frame after press,
|
|
679
679
|
* then auto-resets to `false`.
|
|
680
680
|
*/
|
|
681
681
|
declare interface ButtonConfig {
|
|
@@ -685,12 +685,12 @@ declare interface ButtonConfig {
|
|
|
685
685
|
description?: string;
|
|
686
686
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
687
687
|
group?: string;
|
|
688
|
-
/** Visibility category
|
|
688
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
689
689
|
category?: ParameterCategory;
|
|
690
690
|
}
|
|
691
691
|
|
|
692
692
|
/**
|
|
693
|
-
* Reactive object returned by `viji.button()`. `value` is a momentary flag
|
|
693
|
+
* Reactive object returned by `viji.button()`. `value` is a momentary flag:
|
|
694
694
|
* `true` for exactly one frame after the user clicks, then auto-resets to
|
|
695
695
|
* `false`. Use it to trigger discrete events from `render()`.
|
|
696
696
|
*/
|
|
@@ -703,7 +703,7 @@ declare interface ButtonParameter {
|
|
|
703
703
|
description?: string;
|
|
704
704
|
/** Group name under which the control appears in the UI. */
|
|
705
705
|
group: string;
|
|
706
|
-
/** Visibility category
|
|
706
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
707
707
|
category: ParameterCategory;
|
|
708
708
|
}
|
|
709
709
|
|
|
@@ -736,7 +736,7 @@ declare interface ColorConfig {
|
|
|
736
736
|
description?: string;
|
|
737
737
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
738
738
|
group?: string;
|
|
739
|
-
/** Visibility category
|
|
739
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
740
740
|
category?: ParameterCategory;
|
|
741
741
|
}
|
|
742
742
|
|
|
@@ -797,7 +797,7 @@ declare interface ColorParameter {
|
|
|
797
797
|
description?: string;
|
|
798
798
|
/** Group name under which the control appears in the UI. */
|
|
799
799
|
group: string;
|
|
800
|
-
/** Visibility category
|
|
800
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
801
801
|
category: ParameterCategory;
|
|
802
802
|
}
|
|
803
803
|
|
|
@@ -814,7 +814,7 @@ declare interface CoordinateConfig {
|
|
|
814
814
|
description?: string;
|
|
815
815
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
816
816
|
group?: string;
|
|
817
|
-
/** Visibility category
|
|
817
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
818
818
|
category?: ParameterCategory;
|
|
819
819
|
}
|
|
820
820
|
|
|
@@ -833,7 +833,7 @@ declare interface CoordinateParameter {
|
|
|
833
833
|
description?: string;
|
|
834
834
|
/** Group name under which the control appears in the UI. */
|
|
835
835
|
group: string;
|
|
836
|
-
/** Visibility category
|
|
836
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
837
837
|
category: ParameterCategory;
|
|
838
838
|
}
|
|
839
839
|
|
|
@@ -868,7 +868,7 @@ declare type CVFeature = 'faceDetection' | 'faceMesh' | 'handTracking' | 'poseDe
|
|
|
868
868
|
/**
|
|
869
869
|
* Computer-vision processing rate relative to the scene's render rate.
|
|
870
870
|
* `'full'` runs CV every frame, `'half'` every other frame, `'quarter'` every
|
|
871
|
-
* fourth, `'eighth'` every eighth
|
|
871
|
+
* fourth, `'eighth'` every eighth. Lower rates reduce CPU/GPU cost.
|
|
872
872
|
*/
|
|
873
873
|
declare type CVFrameRateMode = 'full' | 'half' | 'quarter' | 'eighth';
|
|
874
874
|
|
|
@@ -1189,7 +1189,7 @@ export declare interface HandData {
|
|
|
1189
1189
|
/** Depth (relative). */
|
|
1190
1190
|
z: number;
|
|
1191
1191
|
}[];
|
|
1192
|
-
/** Palm center
|
|
1192
|
+
/** Palm center, equivalent to `landmarks[9]` (middle-finger MCP). */
|
|
1193
1193
|
palm: {
|
|
1194
1194
|
/** Palm horizontal coordinate, normalized 0..1. */
|
|
1195
1195
|
x: number;
|
|
@@ -1232,7 +1232,7 @@ declare interface ImageConfig {
|
|
|
1232
1232
|
description?: string;
|
|
1233
1233
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1234
1234
|
group?: string;
|
|
1235
|
-
/** Visibility category
|
|
1235
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1236
1236
|
category?: ParameterCategory;
|
|
1237
1237
|
}
|
|
1238
1238
|
|
|
@@ -1244,7 +1244,7 @@ declare interface ImageConfig {
|
|
|
1244
1244
|
declare interface ImageParameter {
|
|
1245
1245
|
/** Uploaded image as an `ImageBitmap`, or `null` until the user provides one. */
|
|
1246
1246
|
value: ImageBitmap | null;
|
|
1247
|
-
/** P5-compatible image wrapper. Only available in the P5 renderer
|
|
1247
|
+
/** P5-compatible image wrapper. Only available in the P5 renderer; added at runtime by the P5 adapter. */
|
|
1248
1248
|
readonly p5?: any;
|
|
1249
1249
|
/** Display name shown next to the upload field in the parameter UI. */
|
|
1250
1250
|
label: string;
|
|
@@ -1252,7 +1252,7 @@ declare interface ImageParameter {
|
|
|
1252
1252
|
description?: string;
|
|
1253
1253
|
/** Group name under which the control appears in the UI. */
|
|
1254
1254
|
group: string;
|
|
1255
|
-
/** Visibility category
|
|
1255
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1256
1256
|
category: ParameterCategory;
|
|
1257
1257
|
}
|
|
1258
1258
|
|
|
@@ -1377,7 +1377,7 @@ declare interface NumberConfig {
|
|
|
1377
1377
|
description?: string;
|
|
1378
1378
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1379
1379
|
group?: string;
|
|
1380
|
-
/** Visibility category
|
|
1380
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1381
1381
|
category?: ParameterCategory;
|
|
1382
1382
|
}
|
|
1383
1383
|
|
|
@@ -1400,7 +1400,7 @@ declare interface NumberParameter {
|
|
|
1400
1400
|
description?: string;
|
|
1401
1401
|
/** Group name under which the control appears in the UI. */
|
|
1402
1402
|
group: string;
|
|
1403
|
-
/** Visibility category
|
|
1403
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1404
1404
|
category: ParameterCategory;
|
|
1405
1405
|
}
|
|
1406
1406
|
|
|
@@ -1524,7 +1524,7 @@ declare interface PointerAPI {
|
|
|
1524
1524
|
deltaX: number;
|
|
1525
1525
|
/** Vertical movement since the last frame in pixels. */
|
|
1526
1526
|
deltaY: number;
|
|
1527
|
-
/** `true` while the pointer is "down"
|
|
1527
|
+
/** `true` while the pointer is "down": left mouse button held, or a touch active. */
|
|
1528
1528
|
isDown: boolean;
|
|
1529
1529
|
/** `true` for exactly one frame when the pointer becomes down, then auto-resets. */
|
|
1530
1530
|
wasPressed: boolean;
|
|
@@ -1532,7 +1532,7 @@ declare interface PointerAPI {
|
|
|
1532
1532
|
wasReleased: boolean;
|
|
1533
1533
|
/** `true` while the pointer is within the canvas bounds. */
|
|
1534
1534
|
isInCanvas: boolean;
|
|
1535
|
-
/** Currently active input source
|
|
1535
|
+
/** Currently active input source: `'touch'` when at least one touch is active, otherwise `'mouse'` (or `'none'` when the cursor is off-canvas). */
|
|
1536
1536
|
type: 'mouse' | 'touch' | 'none';
|
|
1537
1537
|
}
|
|
1538
1538
|
|
|
@@ -1637,7 +1637,7 @@ declare interface SelectConfig {
|
|
|
1637
1637
|
description?: string;
|
|
1638
1638
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1639
1639
|
group?: string;
|
|
1640
|
-
/** Visibility category
|
|
1640
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1641
1641
|
category?: ParameterCategory;
|
|
1642
1642
|
}
|
|
1643
1643
|
|
|
@@ -1656,7 +1656,7 @@ declare interface SelectParameter {
|
|
|
1656
1656
|
description?: string;
|
|
1657
1657
|
/** Group name under which the control appears in the UI. */
|
|
1658
1658
|
group: string;
|
|
1659
|
-
/** Visibility category
|
|
1659
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1660
1660
|
category: ParameterCategory;
|
|
1661
1661
|
}
|
|
1662
1662
|
|
|
@@ -1677,7 +1677,7 @@ declare interface SliderConfig {
|
|
|
1677
1677
|
description?: string;
|
|
1678
1678
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1679
1679
|
group?: string;
|
|
1680
|
-
/** Visibility category
|
|
1680
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1681
1681
|
category?: ParameterCategory;
|
|
1682
1682
|
}
|
|
1683
1683
|
|
|
@@ -1700,7 +1700,7 @@ declare interface SliderParameter {
|
|
|
1700
1700
|
description?: string;
|
|
1701
1701
|
/** Group name under which the control appears in the UI. */
|
|
1702
1702
|
group: string;
|
|
1703
|
-
/** Visibility category
|
|
1703
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1704
1704
|
category: ParameterCategory;
|
|
1705
1705
|
}
|
|
1706
1706
|
|
|
@@ -1715,7 +1715,7 @@ declare interface TextConfig {
|
|
|
1715
1715
|
description?: string;
|
|
1716
1716
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1717
1717
|
group?: string;
|
|
1718
|
-
/** Visibility category
|
|
1718
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1719
1719
|
category?: ParameterCategory;
|
|
1720
1720
|
/** Maximum character count enforced by the host UI. Default: `1000`. */
|
|
1721
1721
|
maxLength?: number;
|
|
@@ -1736,7 +1736,7 @@ declare interface TextParameter {
|
|
|
1736
1736
|
description?: string;
|
|
1737
1737
|
/** Group name under which the control appears in the UI. */
|
|
1738
1738
|
group: string;
|
|
1739
|
-
/** Visibility category
|
|
1739
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1740
1740
|
category: ParameterCategory;
|
|
1741
1741
|
}
|
|
1742
1742
|
|
|
@@ -1751,7 +1751,7 @@ declare interface ToggleConfig {
|
|
|
1751
1751
|
description?: string;
|
|
1752
1752
|
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
1753
1753
|
group?: string;
|
|
1754
|
-
/** Visibility category
|
|
1754
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
1755
1755
|
category?: ParameterCategory;
|
|
1756
1756
|
}
|
|
1757
1757
|
|
|
@@ -1768,7 +1768,7 @@ declare interface ToggleParameter {
|
|
|
1768
1768
|
description?: string;
|
|
1769
1769
|
/** Group name under which the control appears in the UI. */
|
|
1770
1770
|
group: string;
|
|
1771
|
-
/** Visibility category
|
|
1771
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
1772
1772
|
category: ParameterCategory;
|
|
1773
1773
|
}
|
|
1774
1774
|
|
|
@@ -1777,7 +1777,7 @@ declare interface ToggleParameter {
|
|
|
1777
1777
|
* `started` / `moved` / `ended` arrays for frame-based gesture handling.
|
|
1778
1778
|
*
|
|
1779
1779
|
* For single-point interactions that should also work with a mouse, prefer
|
|
1780
|
-
* `viji.pointer
|
|
1780
|
+
* `viji.pointer`. It switches automatically between mouse and primary touch.
|
|
1781
1781
|
*/
|
|
1782
1782
|
export declare interface TouchAPI {
|
|
1783
1783
|
/** All currently active touch points. Order is stable but not ordered by id. */
|
|
@@ -1814,7 +1814,7 @@ export declare interface TouchEventData {
|
|
|
1814
1814
|
* in canvas-space pixels.
|
|
1815
1815
|
*
|
|
1816
1816
|
* Some fields (notably `pressure` / `force`, `radiusX` / `radiusY`,
|
|
1817
|
-
* `rotationAngle`) are passed through from the device
|
|
1817
|
+
* `rotationAngle`) are passed through from the device; values vary by
|
|
1818
1818
|
* platform; many devices report `0` when unsupported.
|
|
1819
1819
|
*/
|
|
1820
1820
|
declare interface TouchPoint {
|
|
@@ -1826,7 +1826,7 @@ declare interface TouchPoint {
|
|
|
1826
1826
|
y: number;
|
|
1827
1827
|
/** Touch pressure in 0..1 (device-dependent; often `0` on devices without force support). */
|
|
1828
1828
|
pressure: number;
|
|
1829
|
-
/** Contact radius
|
|
1829
|
+
/** Contact radius, `Math.max(radiusX, radiusY)` in pixels. */
|
|
1830
1830
|
radius: number;
|
|
1831
1831
|
/** Horizontal contact radius in pixels (raw device value). */
|
|
1832
1832
|
radiusX: number;
|
|
@@ -1834,7 +1834,7 @@ declare interface TouchPoint {
|
|
|
1834
1834
|
radiusY: number;
|
|
1835
1835
|
/** Contact area rotation in radians (raw device value). */
|
|
1836
1836
|
rotationAngle: number;
|
|
1837
|
-
/** Touch force in 0..1
|
|
1837
|
+
/** Touch force in 0..1; alias of `pressure`. */
|
|
1838
1838
|
force: number;
|
|
1839
1839
|
/** `true` while the touch position is within the canvas bounds. */
|
|
1840
1840
|
isInCanvas: boolean;
|
|
@@ -1885,7 +1885,7 @@ export declare interface VideoAPI {
|
|
|
1885
1885
|
frameRate: number;
|
|
1886
1886
|
/**
|
|
1887
1887
|
* Returns the latest frame as raw RGBA `ImageData` for per-pixel CPU analysis,
|
|
1888
|
-
* or `null` when disconnected. Slow compared to drawing `currentFrame` directly
|
|
1888
|
+
* or `null` when disconnected. Slow compared to drawing `currentFrame` directly;
|
|
1889
1889
|
* use only when you need to read individual pixel values.
|
|
1890
1890
|
*/
|
|
1891
1891
|
getFrameData: () => ImageData | null;
|
|
@@ -1965,13 +1965,13 @@ export declare interface VijiAPI {
|
|
|
1965
1965
|
ctx?: OffscreenCanvasRenderingContext2D;
|
|
1966
1966
|
/** WebGL rendering context. `undefined` until `viji.useContext('webgl')` or `'webgl2'` is called; afterwards equals the cached context. */
|
|
1967
1967
|
gl?: WebGLRenderingContext | WebGL2RenderingContext;
|
|
1968
|
-
/** Current canvas width in pixels. Updates automatically when the host resizes the canvas
|
|
1968
|
+
/** Current canvas width in pixels. Updates automatically when the host resizes the canvas; read every frame. */
|
|
1969
1969
|
width: number;
|
|
1970
|
-
/** Current canvas height in pixels. Updates automatically when the host resizes the canvas
|
|
1970
|
+
/** Current canvas height in pixels. Updates automatically when the host resizes the canvas; read every frame. */
|
|
1971
1971
|
height: number;
|
|
1972
1972
|
/** Seconds elapsed since the scene started (monotonically increasing float). Use for oscillations and absolute-time effects. */
|
|
1973
1973
|
time: number;
|
|
1974
|
-
/** Seconds since the previous frame. Use for accumulation: movement, physics, fades
|
|
1974
|
+
/** Seconds since the previous frame. Use for accumulation: movement, physics, fades, anything that should progress per second regardless of FPS. */
|
|
1975
1975
|
deltaTime: number;
|
|
1976
1976
|
/** Integer frame counter starting at `0` and incrementing by `1` each frame. */
|
|
1977
1977
|
frameCount: number;
|
|
@@ -1981,9 +1981,9 @@ export declare interface VijiAPI {
|
|
|
1981
1981
|
audio: AudioAPI;
|
|
1982
1982
|
/** Main video stream API: pixel access, frame metadata, and computer-vision results (face, hands, pose, segmentation). */
|
|
1983
1983
|
video: VideoAPI;
|
|
1984
|
-
/** Additional video streams provided by the host. These do not run CV processing
|
|
1984
|
+
/** Additional video streams provided by the host. These do not run CV processing; use them for raw pixel access only. */
|
|
1985
1985
|
videoStreams: VideoAPI[];
|
|
1986
|
-
/** Additional audio streams (lightweight analysis: volume, bands, spectral). No beat detection
|
|
1986
|
+
/** Additional audio streams (lightweight analysis: volume, bands, spectral). No beat detection; use the main `audio` for that. */
|
|
1987
1987
|
audioStreams: AudioStreamAPI[];
|
|
1988
1988
|
/** Mouse position, buttons, wheel, and per-frame movement state. Coordinates are in canvas pixels. */
|
|
1989
1989
|
mouse: MouseAPI;
|
|
@@ -1991,7 +1991,7 @@ export declare interface VijiAPI {
|
|
|
1991
1991
|
keyboard: KeyboardAPI;
|
|
1992
1992
|
/** Multi-touch state: count, primary touch shortcut, and the per-frame `started` / `moved` / `ended` arrays. */
|
|
1993
1993
|
touches: TouchAPI;
|
|
1994
|
-
/** Unified pointer (mouse + primary touch)
|
|
1994
|
+
/** Unified pointer (mouse + primary touch). Convenient single-point input that works on both desktop and mobile. */
|
|
1995
1995
|
pointer: PointerAPI;
|
|
1996
1996
|
/** Internal device sensors (motion + orientation) reported by the device running the scene. */
|
|
1997
1997
|
device: DeviceSensorState;
|
|
@@ -1999,7 +1999,7 @@ export declare interface VijiAPI {
|
|
|
1999
1999
|
devices: DeviceState[];
|
|
2000
2000
|
/**
|
|
2001
2001
|
* Declares a numeric slider parameter. The host UI renders a draggable slider.
|
|
2002
|
-
* Must be called at the top level of the scene
|
|
2002
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
2003
2003
|
*
|
|
2004
2004
|
* @example
|
|
2005
2005
|
* const radius = viji.slider(50, { min: 10, max: 200, step: 1, label: 'Radius' });
|
|
@@ -2010,7 +2010,7 @@ export declare interface VijiAPI {
|
|
|
2010
2010
|
/**
|
|
2011
2011
|
* Declares a color parameter. Accepts hex strings, CSS color functions, or RGB / HSB objects;
|
|
2012
2012
|
* the value is always normalized to a canonical lowercase hex string and exposes derived `.rgb` / `.hsb` accessors.
|
|
2013
|
-
* Must be called at the top level of the scene
|
|
2013
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
2014
2014
|
*
|
|
2015
2015
|
* @example
|
|
2016
2016
|
* const tint = viji.color('#ff6600', { label: 'Tint' });
|
|
@@ -2019,7 +2019,7 @@ export declare interface VijiAPI {
|
|
|
2019
2019
|
color: (defaultValue: ColorInput, config: ColorConfig) => ColorParameter;
|
|
2020
2020
|
/**
|
|
2021
2021
|
* Declares a boolean toggle parameter. The host UI renders an on/off switch.
|
|
2022
|
-
* Must be called at the top level of the scene
|
|
2022
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
2023
2023
|
*
|
|
2024
2024
|
* @example
|
|
2025
2025
|
* const showTrail = viji.toggle(true, { label: 'Show Trail' });
|
|
@@ -2028,7 +2028,7 @@ export declare interface VijiAPI {
|
|
|
2028
2028
|
/**
|
|
2029
2029
|
* Declares a dropdown selection parameter. The element type of `options`
|
|
2030
2030
|
* (`string` or `number`) determines the parameter's value type.
|
|
2031
|
-
* Must be called at the top level of the scene
|
|
2031
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
2032
2032
|
*
|
|
2033
2033
|
* @example
|
|
2034
2034
|
* const shape = viji.select('circle', { options: ['circle', 'square', 'triangle'], label: 'Shape' });
|
|
@@ -2036,7 +2036,7 @@ export declare interface VijiAPI {
|
|
|
2036
2036
|
select: (defaultValue: string | number, config: SelectConfig) => SelectParameter;
|
|
2037
2037
|
/**
|
|
2038
2038
|
* Declares a text input parameter. The host UI renders a single-line text field.
|
|
2039
|
-
* Must be called at the top level of the scene
|
|
2039
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
2040
2040
|
*
|
|
2041
2041
|
* @example
|
|
2042
2042
|
* const caption = viji.text('Hello', { label: 'Caption', maxLength: 64 });
|
|
@@ -2045,7 +2045,7 @@ export declare interface VijiAPI {
|
|
|
2045
2045
|
/**
|
|
2046
2046
|
* Declares a precise numeric input parameter. Like `slider()` but the host UI
|
|
2047
2047
|
* shows a number field instead of a draggable handle.
|
|
2048
|
-
* Must be called at the top level of the scene
|
|
2048
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
2049
2049
|
*
|
|
2050
2050
|
* @example
|
|
2051
2051
|
* const count = viji.number(12, { min: 1, max: 64, step: 1, label: 'Count' });
|
|
@@ -2054,7 +2054,7 @@ export declare interface VijiAPI {
|
|
|
2054
2054
|
/**
|
|
2055
2055
|
* Declares an image upload parameter. The user-supplied image becomes available
|
|
2056
2056
|
* as `value` (an `ImageBitmap`); in P5 scenes a `.p5` accessor is also added at runtime.
|
|
2057
|
-
* Must be called at the top level of the scene
|
|
2057
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
2058
2058
|
*
|
|
2059
2059
|
* @example
|
|
2060
2060
|
* const tex = viji.image(null, { label: 'Texture' });
|
|
@@ -2063,8 +2063,8 @@ export declare interface VijiAPI {
|
|
|
2063
2063
|
image: (defaultValue: null, config: ImageConfig) => ImageParameter;
|
|
2064
2064
|
/**
|
|
2065
2065
|
* Declares a momentary button parameter. `value` is `true` for one frame after
|
|
2066
|
-
* the user clicks, then auto-resets
|
|
2067
|
-
* Must be called at the top level of the scene
|
|
2066
|
+
* the user clicks, then auto-resets. Perfect for triggering discrete events.
|
|
2067
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
2068
2068
|
*
|
|
2069
2069
|
* @example
|
|
2070
2070
|
* const reset = viji.button({ label: 'Reset' });
|
|
@@ -2073,7 +2073,7 @@ export declare interface VijiAPI {
|
|
|
2073
2073
|
button: (config: ButtonConfig) => ButtonParameter;
|
|
2074
2074
|
/**
|
|
2075
2075
|
* Declares a 2D coordinate parameter. Both `value.x` and `value.y` are in `-1..1`.
|
|
2076
|
-
* Must be called at the top level of the scene
|
|
2076
|
+
* Must be called at the top level of the scene, never inside `render()`.
|
|
2077
2077
|
*
|
|
2078
2078
|
* @example
|
|
2079
2079
|
* const origin = viji.coordinate({ x: 0, y: 0 }, { label: 'Origin' });
|
|
@@ -2083,7 +2083,7 @@ export declare interface VijiAPI {
|
|
|
2083
2083
|
/**
|
|
2084
2084
|
* Selects the 2D canvas rendering context. Returns the same instance on
|
|
2085
2085
|
* subsequent calls and also stores it on `viji.ctx`. A canvas only supports
|
|
2086
|
-
* one context type
|
|
2086
|
+
* one context type. If a different context type was already requested,
|
|
2087
2087
|
* the call returns `null`. Choose ONE type and use it for the entire scene.
|
|
2088
2088
|
*
|
|
2089
2089
|
* @example
|
|
@@ -2094,14 +2094,14 @@ export declare interface VijiAPI {
|
|
|
2094
2094
|
/**
|
|
2095
2095
|
* Selects a WebGL 1 rendering context. Returns the same instance on subsequent
|
|
2096
2096
|
* calls and also stores it on `viji.gl`. A canvas only supports one context
|
|
2097
|
-
* type
|
|
2097
|
+
* type. If a different context type was already requested, the call returns
|
|
2098
2098
|
* `null`. Choose ONE type and use it for the entire scene.
|
|
2099
2099
|
*/
|
|
2100
2100
|
useContext(type: 'webgl'): WebGLRenderingContext | null;
|
|
2101
2101
|
/**
|
|
2102
2102
|
* Selects a WebGL 2 rendering context. Returns the same instance on subsequent
|
|
2103
2103
|
* calls and also stores it on `viji.gl`. A canvas only supports one context
|
|
2104
|
-
* type
|
|
2104
|
+
* type. If a different context type was already requested, the call returns
|
|
2105
2105
|
* `null`. Choose ONE type and use it for the entire scene.
|
|
2106
2106
|
*/
|
|
2107
2107
|
useContext(type: 'webgl2'): WebGL2RenderingContext | null;
|