ιαηδαπα

ovenbird - alpha

visualdo

WebGL2 particle engine and staged cinematic runtime for Ovenbird browser experiences

como usar

módulo
import * as visualdo from 'https://cdn.iandara.com/mjs/ovenbird/visualdo';
script clássico
<script src="https://cdn.iandara.com/js/ovenbird/visualdo.umd.min"></script>
<!-- window.visualdo -->
no monorepo
import * as visualdo from '@iandara/visualdo';

documentação

Browser-first ESM + self-contained UMD · global window.visualdo.

@iandara/visualdo is the Ovenbird WebGL2 particle engine and the staged runtime built on top of it. It owns the whole chain: rasterizing image, canvas and text sources into particles, the instanced render loop with ping-pong trail, pointer physics — and above that, narrative progress, stage presets, lifecycle, reduced motion, adaptive quality and application hooks.

Visualdo is the particle engine of the family; Aldovisual is the Three.js/WebGPU one. Camera, territory, stagecraft, geometry and heavy multi-pass post-processing belong to Aldovisual. Visualdo owns one deliberately light post chain — separable gaussian bloom, Reinhard tone-map and vignette (postfx_enabled) — because a phosphor-trail particle scene asks for exactly that and nothing more.

Live point sources

Geometry producers can supply particles directly, without image sampling or a canvas. Visualdo remains independent of Geome and brand identity.

const positions = new Float32Array([-0.5, 0, 0.5, 0]);
field.set_source({type: 'points', positions, ids: ['left', 'right'], groups: new Uint32Array([0, 1]), color: [0.7, 0.9, 1]});
positions[1] = 0.25;
field.update_points(positions); // updates targets, retaining particle objects, positions and velocities
field.set_group_transforms({1: {cx: 0.5, cy: 0, angle: 0.4, scale: 1.1, x: 0.1}});
const visible = field.capture_points(new Float32Array(positions.length));
  • positions: nonempty Float32Array of XY pairs, bounded by MAX_INST. Default space: 'normalized' centers the source and scales units by 0.42 * min(viewport_width, viewport_height), Y down. space: 'pixels' uses CSS pixel coordinates from the top left.
  • ids: optional unique strings or finite numbers. Omitted IDs use point indices. Identity is scoped to each layer; reordering explicit IDs preserves motion. Unmatched targets use sorted spatial correspondence. Different populations are resampled from available previous positions when changing source.
  • groups: optional nonnegative integer IDs, one per point. Transforms support x, y, cx, cy, angle in radians and nonnegative scale, in source coordinates.
  • color: normalized RGB, or colors: Float32Array with one normalized RGB triple per point. Optional depth retains the existing layer projection.
  • update_points(positions, layer = 1) requires the existing point count and order; it does not emit layout or rebuild raster/layout/render buffers. Use set_source(source, layer, {keep_positions: true}) for count or identity changes.
  • capture_points(output, layer = 1) writes visible simulation positions into your buffer in source coordinates, before view zoom/projection. It is useful for interruptible gestures.

Buffers are borrowed: keep IDs, groups and color metadata stable while mounted. Reuse position buffers for live updates. Point sources preserve their explicit population independently of raster density; budget that population at creation. Initial raster sources retain their existing density behavior. Public group transforms do not require new geometry or a second render loop.

Analytic point tracks

PointTrack samples equal-sized position buffers over time using quintic interpolation and optional holds:

import {PointTrack} from '@iandara/visualdo';

const track = new PointTrack(
    [
        {at: 0, hold: 1, positions: first_shape},
        {at: 3, positions: second_shape}
    ],
    {duration: 4, loop: true}
);
const output = new Float32Array(first_shape.length);
const state = track.sample(2, output);
field.update_points(output);

Tracks create no animation loop. Drive them from the owning runtime clock; use the existing Timeline for markers. Seeking reconstructs targets independently of traversal order, not the historical state of the particle physics. Frames borrow immutable position buffers and must have increasing times starting at zero. Non-looping tracks clamp to their endpoints.

curve on the destination frame bends the displacement along its perpendicular; stagger in [0, 1) delays particles by their stable index. Endpoints remain exact. ParameterTrack samples matching numeric values objects on increasing at times, with clamped endpoints and smooth interpolation. Both tracks accept caller-owned output buffers/objects.

Reproducible physical playback and export

create_point_playback(field, sample, options) drives existing point layers through the engine's own integrator at a fixed 60 Hz. The sampler updates targets and authored parameters at each simulation time. It must be pure with respect to time. Call playback.seek(seconds) for immediate physical reconstruction, including when the field is paused; playback.destroy() returns physics ownership to the interactive loop. Live input and autonomous phases are excluded from authored integration. Viewport or particle-buffer changes rebuild checkpoints; after other external changes to the simulation configuration, call playback.invalidate().

field.destroy() releases the GPU context explicitly (WEBGL_lose_context) after freeing its own resources, because a destroyed canvas still holds its context until the garbage collector decides otherwise and the browser keeps only about sixteen alive; stop() and pause() keep it.

FixedStepPlayback is the generic bounded-checkpoint controller underneath it. The default budget is 32 checkpoints, one per second, retaining the initial state. Seeking is quantized to 1/60 s and bounded to 600 s. Checkpoints cache motion, noise time and alpha; history-dependent trails are cleared for an explicit seek. Within the same configuration and viewport, reverse/forward seek recovers the same positions and velocities, and the same image: while a playback owns the field, the shader's ambient wave runs on the playback time instead of the wall clock, so one instant is one picture however it was reached (visual regression and video export depend on this). A field with no playback keeps the wall clock. A first distant seek incurs the intervening simulation cost. Call destroy() before discarding the field.

export_point_video({canvas, render, duration, fps, bitrate, signal, on_progress}) creates a VP8 WebM Blob using WebCodecs with offline frame timestamps. render(time) draws one authored frame into the supplied canvas. It accepts synchronous or asynchronous renderers. VP8 availability is checked; frame handles and encoder are closed on completion, error or cancellation. The file includes duration, track metadata and a keyframe seek index. Limits: 120 seconds, 60 fps, 7200 frames, 4096 px per dimension and 256 MiB encoded data. This function exports canvas pixels, without DOM or audio, and creates no animation loop. The Zordan facade coordinates pause and restoration around it.

field.set_phase_time(seconds) gives external time authority to autonomous phases; null resumes their own clock. Selecting a phase directly never repeats crossed random kickers. PhaseSequencer.seek() exposes the same selection without a field.

Regional force fields and measurements

field.set_force_fields([{type: 'vortex', x: 300, y: 200, radius: 120, strength: 0.5, group: 1}]) installs up to 32 smoothly bounded regions, in CSS world pixels. Types: attract, repulse, vortex, flow; group is optional and masks stable point groups. Flow adds optional dx/dy. An empty array clears fields. Group transforms and force fields operate without raster/layout reconstruction.

config.measure_performance: true enables field.stats.performance: rolling median/p95/p99 for render-loop CPU and asynchronous GPU timer queries. Missing GPU timers return null; disjoint samples are discarded. Authoring/replay CPU can be measured separately by the owner. Timers and pending queries are released on teardown. Newer sources invalidate older image/video loads, and disposed video frame callbacks are cancelled.

New engine capabilities (extracted from the Corpus Cordis prototype)

  • Curl noise — config.noise_mode = 'curl' swaps the scalar ambient noise for a divergence-free curl field (engine/noise.mjs): organic drift that never piles particles onto a border. Strength via curl_strength.
  • Parametric curve sources — set_source({type: 'curve', curve: 'heart'}) samples a mathematical curve (border with jitter + interior by rejection) straight into the particle cloud, no raster involved (engine/curves.mjs).
  • Autonomous phases — field.set_phases([{name, dur, spring, damping, gravity, drag, alpha, hold_target, kicker, spark_rate}, ...]) installs a self-running choreography that overrides physics per frame, applies entry kicks (explode, scatter, gather) and can be non-looping (engine/phases.mjs). null hands control back to the global config. Phases also ride set_config({phases}) so presets can carry them.
  • Heartbeat pulse — config.pulse = 'heartbeat' (with pulse_scale) breathes the spring targets with a lub-dub curve while phases are active (engine/pulse.mjs).
  • Golden sparks — field.spawn_sparks(x, y, count) fires pooled, lifetime-based sparks that live in the same instanced buffer behind the shape (trails and blend included). Phases fire them automatically via spark_rate (engine/sparks.mjs).
  • Post FX — config.postfx_enabled = true with bloom_strength, bloom_downsample, vignette_strength (engine/postfx.mjs). Off by default; programs compile lazily on first request.

CORPUS_CORDIS_PRESET / apply_corpus_cordis(field) bundles all of it — heart curve, curl, heartbeat, the ten-phase explode/dissolve/fall choreography, sparks and bloom — as a ready recipe and a usage reference.

import {apply_corpus_cordis, create_particle_field} from '@iandara/visualdo';

const field = create_particle_field(document.querySelector('#palco'), {background: '#040103'});
apply_corpus_cordis(field); // curve heart + phases + pulse + sparks + bloom
field.start();

Corpus Pluma — the Iandara opening

create_pluma_intro(container) is the house intro/credits, choreographed on the same machinery: a parametric feather (curve: 'feather') that is born from a point, breathes (pulse: 'breath'), explodes, reforms, then morphs through the credits — the same texts as the Aldovisual opening, produzido por iandara / orquestrado por ameemude — before dissolving into golden sparks, echoing back to the feather and falling. Curl drift, additive trails and bloom carry the whole look.

import {create_pluma_intro} from '@iandara/visualdo';

const pluma = create_pluma_intro(document.querySelector('#abertura'), {loop: false});
pluma.on('pluma:credit', ({label, brand}) => console.log(`${label} ${brand}`));
pluma.when_done().then(() => pluma.destroy()); // loop: false completes after the fall
pluma.start();

Events: pluma:start, pluma:credit (per morph), pluma:complete (only when loop: false), pluma:error. Pass your own entries via credits: [{label, brand}]; build_pluma_sequence(credits) exposes the pure phase/action plan for testing.

The particle field is usable on its own, without any staging:

import {create_particle_field} from '@iandara/visualdo';

const field = create_particle_field(document.querySelector('#stage'), {background: 'transparent'});
field.start();
await field.set_source({type: 'text', text: 'IANDARA'});

Sources accept text, image, canvas — and video:

// Webm com alfa vira só o que tem pixel; o resto continua vazio.
// A URL toca em streaming (muted + loop + playsinline) e o layout
// reamostra a cada quadro do vídeo, sempre em morfose.
await field.set_source({type: 'video', source: 'https://cdn.iandara.com/webm/onca.alpha.cdn.webm'}, 1, {keep_positions: true});

Video sources play muted, inline and looping, sample through requestVideoFrameCallback when the browser offers it (falling back to config.video_refresh_ms), and pause/resume together with the field. A video element created from a URL is released when the layer changes; an element you passed in yourself is only ever paused, never torn down.

Install

ESM:

import {create_visualdo} from '@iandara/visualdo';

CDN:

<script src="https://cdn.iandara.com/js/ovenbird/visualdo.umd.min"></script>

The CDN exposes window.visualdo.

Live showcase: https://cdn.iandara.com/html/ovenbird/visualdo

Minimal runtime

import {create_visualdo} from '@iandara/visualdo';

const visual = {
    id: 'signal_passage',
    stages: ['origin', 'signal', 'release'],
    presets: {
        origin: {
            source: {type: 'text', text: 'IANDARA', options: {font_px: 44}},
            config: {trail_fade: 0.22, blend_mode: 'screen'},
            mode: 'flow'
        },
        signal: {
            source: {type: 'text', text: 'SINAL VIVO', options: {font_px: 34}},
            config: {wind: 0.35, trail_fade: 0.16},
            mode: 'attract'
        },
        release: {
            source: {type: 'text', text: 'VOLTE SEMPRE', options: {font_px: 30}},
            mode: 'colorize'
        }
    }
};

const app = create_visualdo(document.querySelector('[data-visualdo]'), visual, {
    adaptive_quality: true
}).start();

await app.ready;
app.set_progress(0.5);

stages is divided evenly over progress 0..1 unless get_stage_context(progress) supplies a custom mapping. A resolve_preset(stage_context, runtime_context) function can replace the declarative presets map when a visual needs dynamic composition.

Runtime API

Item Description
create_visualdo(root_element, visual, options?) Creates an unbooted Visualdo runtime.
app.boot() / app.start() Creates and starts the particle field.
app.ready Resolves after async systems and the newest preset requested during boot are ready.
app.set_progress(progress) Resolves stage and applies its preset on a stage change.
app.set_interactions(list) Forwards external interactions to the particle field.
app.set_reduced_motion(enabled) Pauses/resumes ornamental particle motion while retaining the current image.
app.pause() / app.resume() Synchronizes Visualdo orchestration and the engine lifecycle.
app.snapshot(type?, quality?) Returns the composited image as Promise<Blob>.
app.stats() Returns engine stats plus stage, progress, frame pressure and system count.
app.destroy() Disposes hooks, engine resources and the owned stage element.

The event_bus emits app:ready, app:error, app:pause, app:resume, stage:change, visual:progress, visual:preset, quality:pressure, quality:change, renderer:layout, renderer:source, renderer:context-lost and renderer:context-restored.

Visual presets

A preset may contain source or sources, an engine config object, density, zoom, mode and interactions. Visualdo forwards those values only through the documented engine APIs: set_source, set_config, set_density, set_zoom, set_mode and set_interactions. Sources belong to Visualdo's serialized preset queue; renderer_options.source and renderer_options.sources are intentionally ignored so a late constructor load cannot overwrite the current stage.

Visualdo owns the page, so the renderer is mounted as a bare stage: two canvases and a transparent background. The engine draws no controls at all — an app that wants buttons builds them against the public API.

A stage change swaps the source with keep_positions, so particles travel from the previous form into the next one instead of scattering and regrouping.

Writing a preset that reads

Two relationships decide whether a form is legible. The shipped catalogs derive their numbers from them:

  • Sharpness — particle_size: 'auto' ties the quad to the measured layout spacing, so density is the sharpness control and particle_scale only sets overlap. A fixed pixel size below the spacing renders a dotted line.
  • Settling — damping is the velocity kept per frame, so higher means less friction. The catalogs use damping = 1 - 0.68 * sqrt(spring), which lands every scene at roughly 0.6 s. Quiet scenes lower noise_amount; they never weaken spring, because the permanent smear of a form is noise_amount / spring.
const visual = {
    stages: ['calm', 'storm'],
    resolve_preset: context => ({
        id: context.stage,
        source: {type: 'text', text: context.stage === 'calm' ? 'CALMA' : 'TEMPESTADE'},
        config: {trail_fade: context.stage === 'calm' ? 0.3 : 0.12},
        density: context.stage === 'calm' ? 0.8 : 1.6,
        mode: context.stage === 'calm' ? 'flow' : 'repulse'
    })
};

Accessibility and quality

Visualdo honors prefers-reduced-motion by default and follows live preference changes. Pass respect_system_motion: false to opt out, or reduced_motion: true | false to force a choice. In reduced-motion mode the engine renders the current visual and is paused immediately instead of continuously animating particles.

With adaptive_quality enabled (the default), frame pressure gradually lowers the engine max_dpr and particle density relative to the active preset, then restores that preset baseline after a lifecycle reset. The runtime emits quality:pressure and quality:change for app-specific reactions.

Development

The engine facade lives in engine/particle-field.mjs. Its internal collaborators are split by responsibility: field-context.mjs builds state, field-sources.mjs owns image/text/video sources and cleanup, field-interactions.mjs handles input, and field-frame.mjs advances and draws each frame. These modules share the existing context and do not create additional render loops. The public exports remain unchanged, apart from the additive PointTrack API.

task test:unit.package -- @iandara/visualdo
task iandara-ovenbird:build

Run tasks from the repository root. The build generates dist/visualdo.umd.min.js; CDN release remains part of the Ovenbird release flow.