@viji-dev/core 0.8.4 → 0.8.5
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/README.md +1 -1
- package/dist/artist-dts-p5.js +1 -1
- package/dist/artist-dts.js +1 -1
- package/dist/artist-global-p5.d.ts +12 -9
- package/dist/artist-global.d.ts +12 -9
- package/dist/artist-jsdoc.d.ts +1 -1
- package/dist/assets/{viji.worker-BQ4vNMJ0.js → viji.worker-CydIeq-k.js} +2555 -2521
- package/dist/docs-api.js +5 -5
- package/dist/{essentia-wasm.web-H69T-_AQ.js → essentia-wasm.web-DwSQMYtc.js} +2 -2
- package/dist/{index-DF_IFS3A.js → index-DbnjzNSY.js} +7 -7
- package/dist/index.d.ts +14 -11
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/docs-api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const docsApi = {
|
|
2
2
|
"version": "1.1.0",
|
|
3
|
-
"coreVersion": "0.8.
|
|
4
|
-
"generatedAt": "2026-
|
|
3
|
+
"coreVersion": "0.8.4",
|
|
4
|
+
"generatedAt": "2026-06-02T11:07:17.944Z",
|
|
5
5
|
"navigation": [
|
|
6
6
|
{
|
|
7
7
|
"id": "getting-started",
|
|
@@ -1875,7 +1875,7 @@ export const docsApi = {
|
|
|
1875
1875
|
},
|
|
1876
1876
|
{
|
|
1877
1877
|
"type": "text",
|
|
1878
|
-
"markdown": "## When to Use `viji.time` vs `viji.deltaTime`\n\n| Use Case | Property | Why |\n|----------|----------|-----|\n| Oscillation at **constant** speed | `viji.time` | Depends on absolute position in time |\n| Hue cycling at constant rate | `viji.time` | Needs a continuous, monotonic input |\n| Oscillation at **parameter-driven** speed | `viji.deltaTime` (accumulator) | Avoids phase jumps when the slider changes |\n| Position accumulation | `viji.deltaTime` | Must advance the same amount per second, regardless of FPS |\n| Physics / velocity | `viji.deltaTime` | Distance = speed × time elapsed |\n| Fading / easing | `viji.deltaTime` | Progress should be per-second, not per-frame |\n| Periodic events | `viji.time` | Trigger at fixed time intervals |\n\n**Rule of thumb:** if the speed multiplier is a **constant**, `viji.time * constant` is fine. If the speed comes from a **parameter** (slider, etc.), accumulate with `viji.deltaTime` to prevent jumps.\n\n### Accumulator Pattern\n\nWhen animation speed is driven by a user parameter, multiplying `viji.time * speed.value` recalculates the entire phase history every frame: changing the slider causes a visible jump. Instead, accumulate the phase incrementally:\n\n```javascript\nconst speed = viji.slider(1, { min: 0.1, max: 5, label: 'Speed' });\nlet phase = 0;\n\nfunction render(viji) {\n phase += speed.value * viji.deltaTime;\n const x = Math.cos(phase) * radius;\n}\n```\n\nThe slider now only affects future frames: past phase is preserved, so the animation transitions smoothly.\n\n> [!NOTE]\n> For shaders, use [`@viji-accumulator`](/shader/parameters/accumulator) instead: it performs the same integration (`speed × deltaTime`) on the host side and provides the accumulated value as a uniform.\n\n## `viji.frameCount`\n\nAn integer that starts at 0 and increments by 1 every frame. Useful for alternating patterns, sampling every N frames, or seeding frame-unique randomness:\n\n```javascript\nif (viji.frameCount % 60 === 0) {\n // runs once per ~60 frames\n}\n```\n\n## `viji.fps`: Target Frame Rate\n\n`viji.fps` is the **target** frame rate based on the host's frame rate mode and screen refresh rate: it is **not** a measured FPS value:\n\n- `frameRateMode: 'full'` → `viji.fps` equals the screen refresh rate (typically 60 or 120)\n- `frameRateMode: 'half'` → `viji.fps` equals half the screen refresh rate (typically 30 or 60)\n\nThis value is stable and does not fluctuate frame-to-frame. It's useful for informational display or calculations that need the intended rate, but **not** for driving animation: use `viji.time` or `viji.deltaTime` instead.\n\n## Frame-Rate Independence\n\n> [!NOTE]\n> Always use `viji.width` and `viji.height` for positioning and sizing, and `viji.deltaTime` for frame-rate-independent animation. Never hardcode pixel values or assume a specific frame rate.\n\nA scene running at 30 FPS should look the same as one running at 120 FPS. The only way to achieve this is to scale all per-frame accumulation by `viji.deltaTime`:\n\n```javascript\n// Bad: moves faster at higher frame rates\nposition += 5;\n\n// Good: moves at 5 units per second regardless of frame rate\nposition += 5 * viji.deltaTime;\n```\n\n## Next Steps\n\n- [Canvas & Context](/native/canvas-context): [`viji.canvas`](/native/canvas-context), [`viji.useContext()`](/native/canvas-context), dimensions\n- [Parameters](/native/parameters): sliders, colors, toggles\n- [P5 Timing](/p5/timing): timing in the P5 renderer\n- [Shader Timing](/shader/timing): `u_time`, `u_deltaTime`, `u_frame`, `u_fps`\n- [API Reference](/native/api-reference): full list of everything available"
|
|
1878
|
+
"markdown": "## When to Use `viji.time` vs `viji.deltaTime`\n\n| Use Case | Property | Why |\n|----------|----------|-----|\n| Oscillation at **constant** speed | `viji.time` | Depends on absolute position in time |\n| Hue cycling at constant rate | `viji.time` | Needs a continuous, monotonic input |\n| Oscillation at **parameter-driven** speed | `viji.deltaTime` (accumulator) | Avoids phase jumps when the slider changes |\n| Position accumulation | `viji.deltaTime` | Must advance the same amount per second, regardless of FPS |\n| Physics / velocity | `viji.deltaTime` | Distance = speed × time elapsed |\n| Fading / easing | `viji.deltaTime` | Progress should be per-second, not per-frame |\n| Periodic events | `viji.time` | Trigger at fixed time intervals |\n\n**Rule of thumb:** if the speed multiplier is a **constant**, `viji.time * constant` is fine. If the speed comes from a **parameter** (slider, etc.), accumulate with `viji.deltaTime` to prevent jumps.\n\n### Accumulator Pattern\n\nWhen animation speed is driven by a user parameter, multiplying `viji.time * speed.value` recalculates the entire phase history every frame: changing the slider causes a visible jump. Instead, accumulate the phase incrementally:\n\n```javascript\nconst speed = viji.slider(1, { min: 0.1, max: 5, label: 'Speed' });\nlet phase = 0;\n\nfunction render(viji) {\n phase += speed.value * viji.deltaTime;\n const x = Math.cos(phase) * radius;\n}\n```\n\nThe slider now only affects future frames: past phase is preserved, so the animation transitions smoothly.\n\n> [!NOTE]\n> For shaders, use [`@viji-accumulator`](/shader/parameters/accumulator) instead: it performs the same integration (`speed × deltaTime`) on the host side and provides the accumulated value as a uniform.\n\n## `viji.frameCount`\n\nAn integer that starts at 0 and increments by 1 every frame. Useful for alternating patterns, sampling every N frames, or seeding frame-unique randomness:\n\n```javascript\nif (viji.frameCount % 60 === 0) {\n // runs once per ~60 frames\n}\n```\n\n## `viji.fps`: Target Frame Rate\n\n`viji.fps` is the **target** frame rate based on the host's frame rate mode and screen refresh rate: it is **not** a measured FPS value:\n\n- `frameRateMode: 'full'` → `viji.fps` equals the screen refresh rate (typically 60 or 120)\n- `frameRateMode: 'half'` → `viji.fps` equals half the screen refresh rate (typically 30 or 60)\n- `frameRateMode: 'quarter'` → `viji.fps` equals a quarter of the screen refresh rate (typically 15 or 30)\n- `frameRateMode: 'eighth'` → `viji.fps` equals an eighth of the screen refresh rate (typically 7.5 or 15)\n\nThis value is stable and does not fluctuate frame-to-frame. It's useful for informational display or calculations that need the intended rate, but **not** for driving animation: use `viji.time` or `viji.deltaTime` instead.\n\n## Frame-Rate Independence\n\n> [!NOTE]\n> Always use `viji.width` and `viji.height` for positioning and sizing, and `viji.deltaTime` for frame-rate-independent animation. Never hardcode pixel values or assume a specific frame rate.\n\nA scene running at 30 FPS should look the same as one running at 120 FPS. The only way to achieve this is to scale all per-frame accumulation by `viji.deltaTime`:\n\n```javascript\n// Bad: moves faster at higher frame rates\nposition += 5;\n\n// Good: moves at 5 units per second regardless of frame rate\nposition += 5 * viji.deltaTime;\n```\n\n## Next Steps\n\n- [Canvas & Context](/native/canvas-context): [`viji.canvas`](/native/canvas-context), [`viji.useContext()`](/native/canvas-context), dimensions\n- [Parameters](/native/parameters): sliders, colors, toggles\n- [P5 Timing](/p5/timing): timing in the P5 renderer\n- [Shader Timing](/shader/timing): `u_time`, `u_deltaTime`, `u_frame`, `u_fps`\n- [API Reference](/native/api-reference): full list of everything available"
|
|
1879
1879
|
}
|
|
1880
1880
|
]
|
|
1881
1881
|
},
|
|
@@ -4708,7 +4708,7 @@ export const docsApi = {
|
|
|
4708
4708
|
},
|
|
4709
4709
|
{
|
|
4710
4710
|
"type": "text",
|
|
4711
|
-
"markdown": "## When to Use `viji.time` vs `viji.deltaTime`\n\n| Use Case | Property | Why |\n|----------|----------|-----|\n| `p5.sin()` / `p5.cos()` at **constant** speed | `viji.time` | Periodic functions need absolute time |\n| Hue cycling at constant rate | `viji.time` | Continuous monotonic input |\n| Oscillation at **parameter-driven** speed | `viji.deltaTime` (accumulator) | Avoids phase jumps when the slider changes |\n| Position += velocity | `viji.deltaTime` | Distance = speed × elapsed time |\n| Rotation += angular speed | `viji.deltaTime` | Angle increments must be per-second |\n| Opacity fading | `viji.deltaTime` | Fade rate is per-second |\n\n### Accumulator Pattern: Parameter-Driven Speed\n\nWhen animation speed is controlled by a user parameter, do **not** use `viji.time * speed.value`: changing the slider recalculates the full phase history and causes a visible jump. Instead, accumulate incrementally:\n\n```javascript\n// @renderer p5\nconst speed = viji.slider(1, { min: 0.1, max: 5, label: 'Speed' });\nlet phase = 0;\n\nfunction render(viji, p5) {\n phase += speed.value * viji.deltaTime;\n p5.rotate(phase);\n}\n```\n\n> [!TIP]\n> `viji.time * constant` is fine when the multiplier never changes at runtime. The accumulator is only needed when speed is a **user-controlled parameter**. See [Best Practices](/getting-started/best-practices) for the full explanation.\n\n## `viji.frameCount` vs `p5.frameCount`\n\nBoth exist but have different origins:\n\n| Property | Source | Starts At |\n|----------|--------|-----------|\n| `viji.frameCount` | Viji runtime | 0 |\n| `p5.frameCount` | P5 internal | 1 |\n\n`viji.frameCount` is the canonical frame counter across all renderers. It increments by 1 every frame and is consistent whether you're in a native, P5, or shader scene. `p5.frameCount` is maintained by P5 internally and may differ by 1. Use `viji.frameCount` for consistency.\n\n## `viji.fps`: Target Frame Rate\n\n`viji.fps` is the **target** frame rate based on the host's configuration, not a measured value:\n\n- `frameRateMode: 'full'` → screen refresh rate (typically 60 or 120)\n- `frameRateMode: 'half'` → half the screen refresh rate (typically 30 or 60)\n\nThis value is stable and does not fluctuate. Don't use it for animation timing: use `viji.time` or `viji.deltaTime` instead.\n\n> [!NOTE]\n> P5's `frameRate()` function is not available in Viji: the host controls the render loop.\n\n## Frame-Rate Independence\n\n> [!NOTE]\n> Always use `viji.width` and `viji.height` for positioning and sizing, and `viji.deltaTime` for frame-rate-independent animation. Never hardcode pixel values or assume a specific frame rate.\n\n```javascript\n// Bad: speed depends on frame rate\nangle += 0.02;\n\n// Good: same visual speed at any frame rate\nangle += 1.2 * viji.deltaTime; // 1.2 radians per second\n```\n\n## Next Steps\n\n- [Canvas & Resolution](/p5/canvas-resolution): [`viji.width`](/p5/canvas-resolution), [`viji.height`](/p5/canvas-resolution), responsive layouts\n- [Scene Structure](/p5/scene-structure): `setup()`, `render()`, lifecycle\n- [Parameters](/p5/parameters): sliders, colors, toggles\n- [Native Timing](/native/timing): timing in the native renderer\n- [Shader Timing](/shader/timing): `u_time`, `u_deltaTime`, `u_frame`, `u_fps`\n- [API Reference](/p5/api-reference): full list of everything available"
|
|
4711
|
+
"markdown": "## When to Use `viji.time` vs `viji.deltaTime`\n\n| Use Case | Property | Why |\n|----------|----------|-----|\n| `p5.sin()` / `p5.cos()` at **constant** speed | `viji.time` | Periodic functions need absolute time |\n| Hue cycling at constant rate | `viji.time` | Continuous monotonic input |\n| Oscillation at **parameter-driven** speed | `viji.deltaTime` (accumulator) | Avoids phase jumps when the slider changes |\n| Position += velocity | `viji.deltaTime` | Distance = speed × elapsed time |\n| Rotation += angular speed | `viji.deltaTime` | Angle increments must be per-second |\n| Opacity fading | `viji.deltaTime` | Fade rate is per-second |\n\n### Accumulator Pattern: Parameter-Driven Speed\n\nWhen animation speed is controlled by a user parameter, do **not** use `viji.time * speed.value`: changing the slider recalculates the full phase history and causes a visible jump. Instead, accumulate incrementally:\n\n```javascript\n// @renderer p5\nconst speed = viji.slider(1, { min: 0.1, max: 5, label: 'Speed' });\nlet phase = 0;\n\nfunction render(viji, p5) {\n phase += speed.value * viji.deltaTime;\n p5.rotate(phase);\n}\n```\n\n> [!TIP]\n> `viji.time * constant` is fine when the multiplier never changes at runtime. The accumulator is only needed when speed is a **user-controlled parameter**. See [Best Practices](/getting-started/best-practices) for the full explanation.\n\n## `viji.frameCount` vs `p5.frameCount`\n\nBoth exist but have different origins:\n\n| Property | Source | Starts At |\n|----------|--------|-----------|\n| `viji.frameCount` | Viji runtime | 0 |\n| `p5.frameCount` | P5 internal | 1 |\n\n`viji.frameCount` is the canonical frame counter across all renderers. It increments by 1 every frame and is consistent whether you're in a native, P5, or shader scene. `p5.frameCount` is maintained by P5 internally and may differ by 1. Use `viji.frameCount` for consistency.\n\n## `viji.fps`: Target Frame Rate\n\n`viji.fps` is the **target** frame rate based on the host's configuration, not a measured value:\n\n- `frameRateMode: 'full'` → screen refresh rate (typically 60 or 120)\n- `frameRateMode: 'half'` → half the screen refresh rate (typically 30 or 60)\n- `frameRateMode: 'quarter'` → a quarter of the screen refresh rate (typically 15 or 30)\n- `frameRateMode: 'eighth'` → an eighth of the screen refresh rate (typically 7.5 or 15)\n\nThis value is stable and does not fluctuate. Don't use it for animation timing: use `viji.time` or `viji.deltaTime` instead.\n\n> [!NOTE]\n> P5's `frameRate()` function is not available in Viji: the host controls the render loop.\n\n## Frame-Rate Independence\n\n> [!NOTE]\n> Always use `viji.width` and `viji.height` for positioning and sizing, and `viji.deltaTime` for frame-rate-independent animation. Never hardcode pixel values or assume a specific frame rate.\n\n```javascript\n// Bad: speed depends on frame rate\nangle += 0.02;\n\n// Good: same visual speed at any frame rate\nangle += 1.2 * viji.deltaTime; // 1.2 radians per second\n```\n\n## Next Steps\n\n- [Canvas & Resolution](/p5/canvas-resolution): [`viji.width`](/p5/canvas-resolution), [`viji.height`](/p5/canvas-resolution), responsive layouts\n- [Scene Structure](/p5/scene-structure): `setup()`, `render()`, lifecycle\n- [Parameters](/p5/parameters): sliders, colors, toggles\n- [Native Timing](/native/timing): timing in the native renderer\n- [Shader Timing](/shader/timing): `u_time`, `u_deltaTime`, `u_frame`, `u_fps`\n- [API Reference](/p5/api-reference): full list of everything available"
|
|
4712
4712
|
}
|
|
4713
4713
|
]
|
|
4714
4714
|
},
|
|
@@ -7422,7 +7422,7 @@ export const docsApi = {
|
|
|
7422
7422
|
},
|
|
7423
7423
|
{
|
|
7424
7424
|
"type": "text",
|
|
7425
|
-
"markdown": "## `u_deltaTime`: Frame Delta\n\n`u_deltaTime` is the time between the current and previous frame. In shaders, it's primarily useful for:\n\n- Display purposes (showing timing info)\n- Custom accumulation in combination with the `backbuffer`\n- Understanding frame rate behavior\n\nFor most shader animation, `u_time` is the right choice because GLSL is stateless: each pixel is computed independently every frame with no per-pixel accumulation.\n\n## `u_frame`: Frame Counter\n\nAn integer that increments by 1 each frame. Useful for:\n\n- Alternating patterns: `mod(float(u_frame), 2.0)`\n- Noise seeding that changes per frame\n- Periodic events: `mod(float(u_frame), 60.0) < 1.0`\n\n## `u_fps`: Target Frame Rate\n\n`u_fps` is the **target** frame rate based on the host configuration, not a measured value:\n\n- `frameRateMode: 'full'` → screen refresh rate (typically 60.0 or 120.0)\n- `frameRateMode: 'half'` → half the screen refresh rate (typically 30.0 or 60.0)\n\nThis value is stable and does not fluctuate. Use it for informational display, not for animation timing.\n\n## Animation Patterns\n\n### Oscillation\n\n```glsl\nfloat pulse = sin(u_time * 3.14159) * 0.5 + 0.5; // 0..1 pulse, period ~2s\nfloat blink = step(0.5, fract(u_time * 2.0)); // on/off blink, 2 Hz\n```\n\n### Smooth Cycling\n\n```glsl\nfloat t = fract(u_time * 0.25); // 0..1 over 4 seconds, then repeats\nvec3 color = mix(colorA, colorB, t);\n```\n\n### Rotation\n\n```glsl\nfloat angle = u_time * 1.5;\nmat2 rot = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));\nvec2 rotated = rot * uv;\n```\n\n### Speed-Controlled Animation: The Accumulator\n\nWhen you write `u_time * speed`, changing the `speed` slider causes a visible jump because the entire phase is recalculated. The [`@viji-accumulator`](/shader/parameters/accumulator) directive solves this:\n\n```glsl\n// @viji-slider:speed label:\"Speed\" default:1.0 min:0.1 max:5.0\n// @viji-accumulator:phase rate:speed\n\nvoid main() {\n // Use `phase` instead of `u_time * speed`\n float wave = sin(phase * 6.28);\n // ...\n}\n```\n\nThe accumulator adds `speed × deltaTime` to `phase` each frame on the CPU side. Changing `speed` only affects future growth: no backward jumps."
|
|
7425
|
+
"markdown": "## `u_deltaTime`: Frame Delta\n\n`u_deltaTime` is the time between the current and previous frame. In shaders, it's primarily useful for:\n\n- Display purposes (showing timing info)\n- Custom accumulation in combination with the `backbuffer`\n- Understanding frame rate behavior\n\nFor most shader animation, `u_time` is the right choice because GLSL is stateless: each pixel is computed independently every frame with no per-pixel accumulation.\n\n## `u_frame`: Frame Counter\n\nAn integer that increments by 1 each frame. Useful for:\n\n- Alternating patterns: `mod(float(u_frame), 2.0)`\n- Noise seeding that changes per frame\n- Periodic events: `mod(float(u_frame), 60.0) < 1.0`\n\n## `u_fps`: Target Frame Rate\n\n`u_fps` is the **target** frame rate based on the host configuration, not a measured value:\n\n- `frameRateMode: 'full'` → screen refresh rate (typically 60.0 or 120.0)\n- `frameRateMode: 'half'` → half the screen refresh rate (typically 30.0 or 60.0)\n- `frameRateMode: 'quarter'` → a quarter of the screen refresh rate (typically 15.0 or 30.0)\n- `frameRateMode: 'eighth'` → an eighth of the screen refresh rate (typically 7.5 or 15.0)\n\nThis value is stable and does not fluctuate. Use it for informational display, not for animation timing.\n\n## Animation Patterns\n\n### Oscillation\n\n```glsl\nfloat pulse = sin(u_time * 3.14159) * 0.5 + 0.5; // 0..1 pulse, period ~2s\nfloat blink = step(0.5, fract(u_time * 2.0)); // on/off blink, 2 Hz\n```\n\n### Smooth Cycling\n\n```glsl\nfloat t = fract(u_time * 0.25); // 0..1 over 4 seconds, then repeats\nvec3 color = mix(colorA, colorB, t);\n```\n\n### Rotation\n\n```glsl\nfloat angle = u_time * 1.5;\nmat2 rot = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));\nvec2 rotated = rot * uv;\n```\n\n### Speed-Controlled Animation: The Accumulator\n\nWhen you write `u_time * speed`, changing the `speed` slider causes a visible jump because the entire phase is recalculated. The [`@viji-accumulator`](/shader/parameters/accumulator) directive solves this:\n\n```glsl\n// @viji-slider:speed label:\"Speed\" default:1.0 min:0.1 max:5.0\n// @viji-accumulator:phase rate:speed\n\nvoid main() {\n // Use `phase` instead of `u_time * speed`\n float wave = sin(phase * 6.28);\n // ...\n}\n```\n\nThe accumulator adds `speed × deltaTime` to `phase` each frame on the CPU side. Changing `speed` only affects future growth: no backward jumps."
|
|
7426
7426
|
},
|
|
7427
7427
|
{
|
|
7428
7428
|
"type": "live-example",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as kn } from "./index-
|
|
1
|
+
import { g as kn } from "./index-DbnjzNSY.js";
|
|
2
2
|
function jn(Oe, ot) {
|
|
3
3
|
for (var ve = 0; ve < ot.length; ve++) {
|
|
4
4
|
const Z = ot[ve];
|
|
@@ -3374,4 +3374,4 @@ const xn = /* @__PURE__ */ kn(yi), Ln = /* @__PURE__ */ jn({
|
|
|
3374
3374
|
export {
|
|
3375
3375
|
Ln as e
|
|
3376
3376
|
};
|
|
3377
|
-
//# sourceMappingURL=essentia-wasm.web-
|
|
3377
|
+
//# sourceMappingURL=essentia-wasm.web-DwSQMYtc.js.map
|
|
@@ -536,7 +536,7 @@ class DB {
|
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
const hB = "" + new URL("assets/viji.worker-
|
|
539
|
+
const hB = "" + new URL("assets/viji.worker-CydIeq-k.js", import.meta.url).href, RB = new URL("assets/wasm/vision_wasm_internal.js", import.meta.url).href, wB = new URL("assets/wasm/vision_wasm_internal.wasm", import.meta.url).href, sB = new URL("assets/wasm/vision_wasm_nosimd_internal.js", import.meta.url).href, FB = new URL("assets/wasm/vision_wasm_nosimd_internal.wasm", import.meta.url).href;
|
|
540
540
|
class kB {
|
|
541
541
|
constructor(A, B, I) {
|
|
542
542
|
this.iframeManager = A, this.sceneCode = B, this.init = I;
|
|
@@ -1520,7 +1520,7 @@ class lB {
|
|
|
1520
1520
|
if (!this.isInitialized)
|
|
1521
1521
|
return this.initPromise ? this.initPromise : (this.initPromise = (async () => {
|
|
1522
1522
|
try {
|
|
1523
|
-
const A = await import("./essentia.js-core.es-CC_3Ap1i.js"), B = await import("./essentia-wasm.web-
|
|
1523
|
+
const A = await import("./essentia.js-core.es-CC_3Ap1i.js"), B = await import("./essentia-wasm.web-DwSQMYtc.js").then((g) => g.e), I = A.Essentia || A.default?.Essentia || A.default;
|
|
1524
1524
|
let Q = B.default || B.EssentiaWASM || B.default?.EssentiaWASM;
|
|
1525
1525
|
if (!Q)
|
|
1526
1526
|
throw new Error("WASM module not found - check essentia-wasm.web.js export");
|
|
@@ -8019,7 +8019,7 @@ class K {
|
|
|
8019
8019
|
}
|
|
8020
8020
|
/**
|
|
8021
8021
|
* Sets the scene frame rate mode
|
|
8022
|
-
* @param mode -
|
|
8022
|
+
* @param mode - render every animation frame (`'full'`), every 2nd (`'half'`), every 4th (`'quarter'`), or every 8th (`'eighth'`)
|
|
8023
8023
|
*/
|
|
8024
8024
|
async setFrameRate(A) {
|
|
8025
8025
|
this.validateReady(), this.config.frameRateMode = A, this.workerManager && this.workerManager.postMessage("frame-rate-update", { mode: A }), this.updateFrameRateStats(), this.debugLog(`Scene frame rate set to ${A} (${this.instanceId})`);
|
|
@@ -8727,8 +8727,8 @@ class K {
|
|
|
8727
8727
|
);
|
|
8728
8728
|
if (!A.sceneCode || typeof A.sceneCode != "string")
|
|
8729
8729
|
throw new S("sceneCode must be a non-empty string", "INVALID_CONFIG");
|
|
8730
|
-
if (A.frameRateMode !== void 0 &&
|
|
8731
|
-
throw new S('frameRateMode must be
|
|
8730
|
+
if (A.frameRateMode !== void 0 && !["full", "half", "quarter", "eighth"].includes(A.frameRateMode))
|
|
8731
|
+
throw new S('frameRateMode must be one of "full", "half", "quarter", or "eighth"', "INVALID_CONFIG");
|
|
8732
8732
|
}
|
|
8733
8733
|
/**
|
|
8734
8734
|
* Cleans up all resources
|
|
@@ -8752,7 +8752,7 @@ function DI(h) {
|
|
|
8752
8752
|
expectedVersion: 1
|
|
8753
8753
|
} : typeof A.senderTime != "number" ? { code: "invalid-field", details: "senderTime must be a number", field: "senderTime" } : null;
|
|
8754
8754
|
}
|
|
8755
|
-
const hI = "0.8.
|
|
8755
|
+
const hI = "0.8.4";
|
|
8756
8756
|
export {
|
|
8757
8757
|
yA as A,
|
|
8758
8758
|
hI as V,
|
|
@@ -8760,4 +8760,4 @@ export {
|
|
|
8760
8760
|
S as b,
|
|
8761
8761
|
PB as g
|
|
8762
8762
|
};
|
|
8763
|
-
//# sourceMappingURL=index-
|
|
8763
|
+
//# sourceMappingURL=index-DbnjzNSY.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -946,9 +946,10 @@ export declare interface CVActivity {
|
|
|
946
946
|
declare type CVFeature = 'faceDetection' | 'faceMesh' | 'handTracking' | 'poseDetection' | 'bodySegmentation' | 'emotionDetection';
|
|
947
947
|
|
|
948
948
|
/**
|
|
949
|
-
* Computer-vision processing rate relative to the
|
|
950
|
-
* `'full'` runs CV every frame, `'half'` every other frame,
|
|
951
|
-
* fourth, `'eighth'` every eighth. Lower rates reduce CPU/GPU
|
|
949
|
+
* Computer-vision processing rate relative to the input video stream rate.
|
|
950
|
+
* `'full'` runs CV on every delivered video frame, `'half'` every other frame,
|
|
951
|
+
* `'quarter'` every fourth, `'eighth'` every eighth. Lower rates reduce CPU/GPU
|
|
952
|
+
* cost. (Throttles the camera/stream frame cadence, independent of scene FPS.)
|
|
952
953
|
*/
|
|
953
954
|
declare type CVFrameRateMode = 'full' | 'half' | 'quarter' | 'eighth';
|
|
954
955
|
|
|
@@ -1286,11 +1287,13 @@ declare interface FrameRateInfo {
|
|
|
1286
1287
|
}
|
|
1287
1288
|
|
|
1288
1289
|
/**
|
|
1289
|
-
* Render-loop pacing mode. `'full'` runs `render()` on every animation frame
|
|
1290
|
-
*
|
|
1291
|
-
* lower-cost scenes.
|
|
1290
|
+
* Render-loop pacing mode. `'full'` runs `render()` on every animation frame,
|
|
1291
|
+
* `'half'` every 2nd frame, `'quarter'` every 4th, `'eighth'` every 8th. Lower
|
|
1292
|
+
* rates save CPU/GPU on lower-cost scenes. The resulting FPS is the screen
|
|
1293
|
+
* refresh rate divided by the mode divisor (1/2/4/8), so on a 60 Hz display:
|
|
1294
|
+
* `'full'` ~60, `'half'` ~30, `'quarter'` ~15, `'eighth'` ~7.5.
|
|
1292
1295
|
*/
|
|
1293
|
-
declare type FrameRateMode = 'full' | 'half';
|
|
1296
|
+
declare type FrameRateMode = 'full' | 'half' | 'quarter' | 'eighth';
|
|
1294
1297
|
|
|
1295
1298
|
/**
|
|
1296
1299
|
* One named frequency band reported by the audio analyzer
|
|
@@ -2654,7 +2657,7 @@ declare type TrackingState = 'TRACKING' | 'LOCKED' | 'BREAKDOWN' | 'LOST';
|
|
|
2654
2657
|
/** Returned by `on*` listener registration calls; invoke to unsubscribe. */
|
|
2655
2658
|
export declare type Unsubscribe = () => void;
|
|
2656
2659
|
|
|
2657
|
-
export declare const VERSION = "0.8.
|
|
2660
|
+
export declare const VERSION = "0.8.4";
|
|
2658
2661
|
|
|
2659
2662
|
/**
|
|
2660
2663
|
* Real-time video API: drawable frame, dimensions, and the source-side
|
|
@@ -2870,7 +2873,7 @@ export declare interface VijiAPI {
|
|
|
2870
2873
|
deltaTime: number;
|
|
2871
2874
|
/** Integer frame counter starting at `0` and incrementing by `1` each frame. */
|
|
2872
2875
|
frameCount: number;
|
|
2873
|
-
/** Target frames-per-second for the host's current frame-rate mode (
|
|
2876
|
+
/** Target frames-per-second for the host's current frame-rate mode (screen refresh rate divided by the mode divisor 1/2/4/8). */
|
|
2874
2877
|
fps: number;
|
|
2875
2878
|
/** Real-time analysis of the main audio stream: volume, frequency bands, beat detection, spectral features. Fields are zeroed when no audio source is connected. */
|
|
2876
2879
|
audio: AudioAPI;
|
|
@@ -3447,7 +3450,7 @@ export declare class VijiCore {
|
|
|
3447
3450
|
private notifyParameterListeners;
|
|
3448
3451
|
/**
|
|
3449
3452
|
* Sets the scene frame rate mode
|
|
3450
|
-
* @param mode -
|
|
3453
|
+
* @param mode - render every animation frame (`'full'`), every 2nd (`'half'`), every 4th (`'quarter'`), or every 8th (`'eighth'`)
|
|
3451
3454
|
*/
|
|
3452
3455
|
setFrameRate(mode: FrameRateMode): Promise<void>;
|
|
3453
3456
|
/**
|
|
@@ -3937,7 +3940,7 @@ export declare interface VijiCoreConfig {
|
|
|
3937
3940
|
hostContainer?: HTMLElement;
|
|
3938
3941
|
/** Artist scene code to execute */
|
|
3939
3942
|
sceneCode: string;
|
|
3940
|
-
/** Frame rate mode - 'full'
|
|
3943
|
+
/** Frame rate mode - render every frame (`'full'`), every 2nd (`'half'`), every 4th (`'quarter'`), or every 8th (`'eighth'`). */
|
|
3941
3944
|
frameRateMode?: FrameRateMode;
|
|
3942
3945
|
/** Resolution: scale (number) or explicit dimensions (object). Required for headless, must be object form */
|
|
3943
3946
|
resolution?: number | {
|
package/dist/index.js
CHANGED