agentvfx 0.0.0-stage → 0.3.4
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/AGENTS.md +8 -0
- package/GEMINI.md +1 -0
- package/LICENSE +172 -0
- package/README.md +236 -2
- package/package.json +35 -4
- package/skills/agentvfx/LICENSE +172 -0
- package/skills/agentvfx/NOTICE +44 -0
- package/skills/agentvfx/SKILL.md +90 -0
- package/skills/agentvfx/engine/core/constants.mjs +84 -0
- package/skills/agentvfx/engine/core/flash-constants.mjs +23 -0
- package/skills/agentvfx/engine/core/flash.mjs +240 -0
- package/skills/agentvfx/engine/core/mark.mjs +28 -0
- package/skills/agentvfx/engine/core/palettes.mjs +36 -0
- package/skills/agentvfx/engine/core/schedule.mjs +85 -0
- package/skills/agentvfx/engine/core/templates.mjs +43 -0
- package/skills/agentvfx/engine/core/util.mjs +167 -0
- package/skills/agentvfx/engine/core/validate.mjs +334 -0
- package/skills/agentvfx/engine/node/analysis.mjs +172 -0
- package/skills/agentvfx/engine/node/audio.mjs +621 -0
- package/skills/agentvfx/engine/node/board.mjs +24 -0
- package/skills/agentvfx/engine/node/chrome.mjs +349 -0
- package/skills/agentvfx/engine/node/encode.mjs +110 -0
- package/skills/agentvfx/engine/node/eye.mjs +77 -0
- package/skills/agentvfx/engine/node/footage.mjs +129 -0
- package/skills/agentvfx/engine/node/frame-worker.mjs +39 -0
- package/skills/agentvfx/engine/node/host.mjs +31 -0
- package/skills/agentvfx/engine/node/job.mjs +181 -0
- package/skills/agentvfx/engine/node/png.mjs +112 -0
- package/skills/agentvfx/engine/node/render.mjs +161 -0
- package/skills/agentvfx/engine/node/stage-capture.mjs +187 -0
- package/skills/agentvfx/engine/node/stage-serve.mjs +72 -0
- package/skills/agentvfx/engine/node/stills.mjs +100 -0
- package/skills/agentvfx/engine/node/ws-server.mjs +132 -0
- package/skills/agentvfx/engine/web/gl.mjs +319 -0
- package/skills/agentvfx/engine/web/glsl-common.mjs +78 -0
- package/skills/agentvfx/engine/web/init.js +23 -0
- package/skills/agentvfx/engine/web/prelude.mjs +150 -0
- package/skills/agentvfx/engine/web/render.html +11 -0
- package/skills/agentvfx/engine/web/render.mjs +388 -0
- package/skills/agentvfx/engine/web/scale.mjs +15 -0
- package/skills/agentvfx/engine/web/text.mjs +158 -0
- package/skills/agentvfx/plates/terminalcore/README.md +61 -0
- package/skills/agentvfx/plates/terminalcore/__pycache__/crt.cpython-313.pyc +0 -0
- package/skills/agentvfx/plates/terminalcore/__pycache__/font.cpython-313.pyc +0 -0
- package/skills/agentvfx/plates/terminalcore/__pycache__/gallery.cpython-313.pyc +0 -0
- package/skills/agentvfx/plates/terminalcore/__pycache__/gallery_mats.cpython-313.pyc +0 -0
- package/skills/agentvfx/plates/terminalcore/__pycache__/gallery_room.cpython-313.pyc +0 -0
- package/skills/agentvfx/plates/terminalcore/__pycache__/materials.cpython-313.pyc +0 -0
- package/skills/agentvfx/plates/terminalcore/__pycache__/nodekit.cpython-313.pyc +0 -0
- package/skills/agentvfx/plates/terminalcore/__pycache__/room.cpython-313.pyc +0 -0
- package/skills/agentvfx/plates/terminalcore/__pycache__/shots.cpython-313.pyc +0 -0
- package/skills/agentvfx/plates/terminalcore/__pycache__/textures.cpython-313.pyc +0 -0
- package/skills/agentvfx/plates/terminalcore/__pycache__/wall.cpython-313.pyc +0 -0
- package/skills/agentvfx/plates/terminalcore/crt.py +143 -0
- package/skills/agentvfx/plates/terminalcore/font.py +80 -0
- package/skills/agentvfx/plates/terminalcore/gallery.py +61 -0
- package/skills/agentvfx/plates/terminalcore/gallery_mats.py +144 -0
- package/skills/agentvfx/plates/terminalcore/gallery_room.py +126 -0
- package/skills/agentvfx/plates/terminalcore/materials.py +170 -0
- package/skills/agentvfx/plates/terminalcore/nodekit.py +87 -0
- package/skills/agentvfx/plates/terminalcore/room.py +82 -0
- package/skills/agentvfx/plates/terminalcore/scene.py +219 -0
- package/skills/agentvfx/plates/terminalcore/shots.py +48 -0
- package/skills/agentvfx/plates/terminalcore/textures.py +79 -0
- package/skills/agentvfx/plates/terminalcore/wall.py +103 -0
- package/skills/agentvfx/references/plates.md +22 -0
- package/skills/agentvfx/references/template-format.md +149 -0
- package/skills/agentvfx/references/web.md +63 -0
- package/skills/agentvfx/runtime/agentvfx.js +708 -0
- package/skills/agentvfx/schemas/fx-score.schema.json +98 -0
- package/skills/agentvfx/scripts/export-web.mjs +155 -0
- package/skills/agentvfx/scripts/loop.mjs +129 -0
- package/skills/agentvfx/scripts/make-beat.mjs +133 -0
- package/skills/agentvfx/scripts/plate.mjs +82 -0
- package/skills/agentvfx/scripts/vfx.mjs +173 -0
- package/skills/agentvfx/templates/_test/feedback-counter/fx.json +11 -0
- package/skills/agentvfx/templates/_test/feedback-counter/main.frag +4 -0
- package/skills/agentvfx/templates/_test/feedback-counter/pass0.frag +4 -0
- package/skills/agentvfx/templates/_test/gradient/fx.json +23 -0
- package/skills/agentvfx/templates/_test/gradient/main.frag +5 -0
- package/skills/agentvfx/templates/_test/identity/fx.json +10 -0
- package/skills/agentvfx/templates/_test/identity/main.frag +4 -0
- package/skills/agentvfx/templates/_test/strobe/fx.json +14 -0
- package/skills/agentvfx/templates/_test/strobe/main.frag +6 -0
- package/skills/agentvfx/templates/_test/text-probe/fx.json +15 -0
- package/skills/agentvfx/templates/_test/text-probe/main.frag +6 -0
- package/skills/agentvfx/templates/brutal/NOTES.md +14 -0
- package/skills/agentvfx/templates/brutal/_src/boot-log/def.mjs +57 -0
- package/skills/agentvfx/templates/brutal/_src/boot-log/main.src.frag +129 -0
- package/skills/agentvfx/templates/brutal/_src/build.mjs +33 -0
- package/skills/agentvfx/templates/brutal/_src/halftone-field/def.mjs +72 -0
- package/skills/agentvfx/templates/brutal/_src/halftone-field/main.src.frag +94 -0
- package/skills/agentvfx/templates/brutal/_src/hud-deck/deck-left.src.glsl +100 -0
- package/skills/agentvfx/templates/brutal/_src/hud-deck/deck-right.src.glsl +61 -0
- package/skills/agentvfx/templates/brutal/_src/hud-deck/deck-tiles.src.glsl +153 -0
- package/skills/agentvfx/templates/brutal/_src/hud-deck/def.mjs +82 -0
- package/skills/agentvfx/templates/brutal/_src/hud-deck/main.src.frag +110 -0
- package/skills/agentvfx/templates/brutal/_src/hud-deck/pass0.src.frag +38 -0
- package/skills/agentvfx/templates/brutal/_src/shared/defs.mjs +28 -0
- package/skills/agentvfx/templates/brutal/_src/shared/icons.glsl +72 -0
- package/skills/agentvfx/templates/brutal/_src/shared/lib.glsl +115 -0
- package/skills/agentvfx/templates/brutal/_src/shared/screen.glsl +43 -0
- package/skills/agentvfx/templates/brutal/boot-log/demo-acid.json +1 -0
- package/skills/agentvfx/templates/brutal/boot-log/demo-phosphor.json +1 -0
- package/skills/agentvfx/templates/brutal/boot-log/demo-ultramarine.json +1 -0
- package/skills/agentvfx/templates/brutal/boot-log/fx.json +257 -0
- package/skills/agentvfx/templates/brutal/boot-log/main.frag +242 -0
- package/skills/agentvfx/templates/brutal/collage/_src/00-lib.glsl +73 -0
- package/skills/agentvfx/templates/brutal/collage/_src/10-spectrum-scope.glsl +73 -0
- package/skills/agentvfx/templates/brutal/collage/_src/20-meter-readout-cross.glsl +87 -0
- package/skills/agentvfx/templates/brutal/collage/_src/30-footage-fillers.glsl +92 -0
- package/skills/agentvfx/templates/brutal/collage/_src/40-editorial.glsl +232 -0
- package/skills/agentvfx/templates/brutal/collage/_src/50-typefx.glsl +163 -0
- package/skills/agentvfx/templates/brutal/collage/_src/60-scene-lib.glsl +104 -0
- package/skills/agentvfx/templates/brutal/collage/_src/61-scene-specimen.glsl +71 -0
- package/skills/agentvfx/templates/brutal/collage/_src/62-scene-wiring.glsl +96 -0
- package/skills/agentvfx/templates/brutal/collage/_src/63-scene-fieldcut.glsl +119 -0
- package/skills/agentvfx/templates/brutal/collage/_src/64-scene-pattern.glsl +64 -0
- package/skills/agentvfx/templates/brutal/collage/_src/641-scene-anatomy.glsl +49 -0
- package/skills/agentvfx/templates/brutal/collage/_src/642-scene-deck.glsl +78 -0
- package/skills/agentvfx/templates/brutal/collage/_src/643-scene-bootlog.glsl +60 -0
- package/skills/agentvfx/templates/brutal/collage/_src/644-scene-tunnel.glsl +48 -0
- package/skills/agentvfx/templates/brutal/collage/_src/645-scene-runner.glsl +42 -0
- package/skills/agentvfx/templates/brutal/collage/_src/646-scene-ascii.glsl +66 -0
- package/skills/agentvfx/templates/brutal/collage/_src/647-scene-cubewall.glsl +80 -0
- package/skills/agentvfx/templates/brutal/collage/_src/648-scene-vortex.glsl +46 -0
- package/skills/agentvfx/templates/brutal/collage/_src/649-scene-sticker.glsl +72 -0
- package/skills/agentvfx/templates/brutal/collage/_src/65-scene-main.glsl +1 -0
- package/skills/agentvfx/templates/brutal/collage/_src/650-scene-ribbon.glsl +55 -0
- package/skills/agentvfx/templates/brutal/collage/_src/651-scene-slab.glsl +38 -0
- package/skills/agentvfx/templates/brutal/collage/_src/652-scene-framedial.glsl +79 -0
- package/skills/agentvfx/templates/brutal/collage/_src/653-scene-tilt.glsl +40 -0
- package/skills/agentvfx/templates/brutal/collage/_src/654-scene-marquee.glsl +45 -0
- package/skills/agentvfx/templates/brutal/collage/_src/655-scene-lens.glsl +57 -0
- package/skills/agentvfx/templates/brutal/collage/_src/656-scene-liquid.glsl +35 -0
- package/skills/agentvfx/templates/brutal/collage/_src/657-scene-panelgrid.glsl +75 -0
- package/skills/agentvfx/templates/brutal/collage/_src/658-scene-mirror.glsl +49 -0
- package/skills/agentvfx/templates/brutal/collage/_src/66-scene-main.glsl +27 -0
- package/skills/agentvfx/templates/brutal/collage/_src/90-main.glsl +120 -0
- package/skills/agentvfx/templates/brutal/collage/_src/build.mjs +24 -0
- package/skills/agentvfx/templates/brutal/collage/_src/sync-presets.mjs +16 -0
- package/skills/agentvfx/templates/brutal/collage/demo-bone-lime.json +1 -0
- package/skills/agentvfx/templates/brutal/collage/demo-lime-sparse.json +1 -0
- package/skills/agentvfx/templates/brutal/collage/demo-orange-dense.json +1 -0
- package/skills/agentvfx/templates/brutal/collage/demo-ultra-slow.json +1 -0
- package/skills/agentvfx/templates/brutal/collage/fx.json +4882 -0
- package/skills/agentvfx/templates/brutal/collage/layout.mjs +97 -0
- package/skills/agentvfx/templates/brutal/collage/layouts.json +366 -0
- package/skills/agentvfx/templates/brutal/collage/main.frag +2367 -0
- package/skills/agentvfx/templates/brutal/collage/pass0.frag +265 -0
- package/skills/agentvfx/templates/brutal/halftone-field/demo-acid.json +1 -0
- package/skills/agentvfx/templates/brutal/halftone-field/demo-ascii.json +1 -0
- package/skills/agentvfx/templates/brutal/halftone-field/demo-dither.json +1 -0
- package/skills/agentvfx/templates/brutal/halftone-field/demo-orange.json +1 -0
- package/skills/agentvfx/templates/brutal/halftone-field/demo-phosphor.json +1 -0
- package/skills/agentvfx/templates/brutal/halftone-field/demo-ultramarine.json +1 -0
- package/skills/agentvfx/templates/brutal/halftone-field/fx.json +474 -0
- package/skills/agentvfx/templates/brutal/halftone-field/main.frag +248 -0
- package/skills/agentvfx/templates/brutal/hud-deck/demo-acid.json +1 -0
- package/skills/agentvfx/templates/brutal/hud-deck/demo-night.json +1 -0
- package/skills/agentvfx/templates/brutal/hud-deck/demo-octagon.json +1 -0
- package/skills/agentvfx/templates/brutal/hud-deck/demo-ultramarine.json +1 -0
- package/skills/agentvfx/templates/brutal/hud-deck/fx.json +601 -0
- package/skills/agentvfx/templates/brutal/hud-deck/main.frag +645 -0
- package/skills/agentvfx/templates/brutal/hud-deck/pass0.frag +38 -0
- package/skills/agentvfx/templates/brutal/lattice/demo-cobalt-fine.json +1 -0
- package/skills/agentvfx/templates/brutal/lattice/demo-ink-yellow.json +1 -0
- package/skills/agentvfx/templates/brutal/lattice/demo-vermilion.json +1 -0
- package/skills/agentvfx/templates/brutal/lattice/demo-violet-slow.json +1 -0
- package/skills/agentvfx/templates/brutal/lattice/fx.json +130 -0
- package/skills/agentvfx/templates/brutal/lattice/main.frag +175 -0
- package/skills/agentvfx/templates/brutal/lattice/pass0.frag +29 -0
- package/skills/agentvfx/templates/glitch/block-glitch/demo-mosaic.json +1 -0
- package/skills/agentvfx/templates/glitch/block-glitch/demo-onset.json +1 -0
- package/skills/agentvfx/templates/glitch/block-glitch/demo-static.json +1 -0
- package/skills/agentvfx/templates/glitch/block-glitch/demo-tear.json +1 -0
- package/skills/agentvfx/templates/glitch/block-glitch/fx.json +54 -0
- package/skills/agentvfx/templates/glitch/block-glitch/main.frag +132 -0
- package/skills/agentvfx/templates/glitch/block-glitch/pass0.frag +12 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/NOTES.md +13 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/build-passes.mjs +162 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/demo-chunk.json +1 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/demo-hue.json +1 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/demo-kick.json +1 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/demo-streak.json +1 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/demo-vertical.json +1 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/fx.json +60 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/main.frag +83 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/pass0.frag +64 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/pass1.frag +66 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/pass2.frag +66 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/pass3.frag +66 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/pass4.frag +66 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/pass5.frag +66 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/pass6.frag +66 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/pass7.frag +66 -0
- package/skills/agentvfx/templates/glitch/pixel-sort/pass8.frag +66 -0
- package/skills/agentvfx/templates/glitch/rgb-split/demo-diagonal-stutter.json +1 -0
- package/skills/agentvfx/templates/glitch/rgb-split/demo-hard.json +1 -0
- package/skills/agentvfx/templates/glitch/rgb-split/demo-kick.json +1 -0
- package/skills/agentvfx/templates/glitch/rgb-split/demo-radial.json +1 -0
- package/skills/agentvfx/templates/glitch/rgb-split/fx.json +46 -0
- package/skills/agentvfx/templates/glitch/rgb-split/main.frag +76 -0
- package/skills/agentvfx/templates/glitch/vhs/demo-clean.json +1 -0
- package/skills/agentvfx/templates/glitch/vhs/demo-crash.json +1 -0
- package/skills/agentvfx/templates/glitch/vhs/demo-tape.json +1 -0
- package/skills/agentvfx/templates/glitch/vhs/demo-worn.json +1 -0
- package/skills/agentvfx/templates/glitch/vhs/fx.json +46 -0
- package/skills/agentvfx/templates/glitch/vhs/main.frag +96 -0
- package/skills/agentvfx/templates/impact/impact-1bit/demo-onebit-bayer.json +1 -0
- package/skills/agentvfx/templates/impact/impact-1bit/fx.json +45 -0
- package/skills/agentvfx/templates/impact/impact-1bit/main.frag +64 -0
- package/skills/agentvfx/templates/impact/impact-invert/demo-invert-snap.json +1 -0
- package/skills/agentvfx/templates/impact/impact-invert/fx.json +37 -0
- package/skills/agentvfx/templates/impact/impact-invert/main.frag +44 -0
- package/skills/agentvfx/templates/impact/punch-shake/demo-punch-hard.json +1 -0
- package/skills/agentvfx/templates/impact/punch-shake/fx.json +36 -0
- package/skills/agentvfx/templates/impact/punch-shake/main.frag +62 -0
- package/skills/agentvfx/templates/impact/rgb-hit/demo-rgb-slam.json +1 -0
- package/skills/agentvfx/templates/impact/rgb-hit/fx.json +39 -0
- package/skills/agentvfx/templates/impact/rgb-hit/main.frag +62 -0
- package/skills/agentvfx/templates/impact/signal-cut/demo-lime-hold.json +1 -0
- package/skills/agentvfx/templates/impact/signal-cut/demo-lime.json +1 -0
- package/skills/agentvfx/templates/impact/signal-cut/demo-orange.json +1 -0
- package/skills/agentvfx/templates/impact/signal-cut/demo-ultramarine.json +1 -0
- package/skills/agentvfx/templates/impact/signal-cut/fx.json +83 -0
- package/skills/agentvfx/templates/impact/signal-cut/main.frag +101 -0
- package/skills/agentvfx/templates/impact/signal-cut/pass0.frag +68 -0
- package/skills/agentvfx/templates/impact/speedline-burst/demo-speed-white.json +1 -0
- package/skills/agentvfx/templates/impact/speedline-burst/fx.json +44 -0
- package/skills/agentvfx/templates/impact/speedline-burst/main.frag +68 -0
- package/skills/agentvfx/templates/impact/strobe-burst/demo-strobe-white-16.json +1 -0
- package/skills/agentvfx/templates/impact/strobe-burst/fx.json +42 -0
- package/skills/agentvfx/templates/impact/strobe-burst/main.frag +43 -0
- package/skills/agentvfx/templates/light/anamorphic-streak/demo-anamorphic-cinema.json +10 -0
- package/skills/agentvfx/templates/light/anamorphic-streak/demo-data.json +10 -0
- package/skills/agentvfx/templates/light/anamorphic-streak/fx.json +47 -0
- package/skills/agentvfx/templates/light/anamorphic-streak/main.frag +45 -0
- package/skills/agentvfx/templates/light/anamorphic-streak/pass0.frag +22 -0
- package/skills/agentvfx/templates/light/anamorphic-streak/pass1.frag +16 -0
- package/skills/agentvfx/templates/light/anamorphic-streak/pass2.frag +16 -0
- package/skills/agentvfx/templates/light/anamorphic-streak/pass3.frag +16 -0
- package/skills/agentvfx/templates/light/bloom-glow/demo-clip01-low.json +11 -0
- package/skills/agentvfx/templates/light/bloom-glow/demo-neon-night.json +10 -0
- package/skills/agentvfx/templates/light/bloom-glow/demo-phosphor.json +11 -0
- package/skills/agentvfx/templates/light/bloom-glow/fx.json +53 -0
- package/skills/agentvfx/templates/light/bloom-glow/main.frag +85 -0
- package/skills/agentvfx/templates/light/bloom-glow/pass0.frag +21 -0
- package/skills/agentvfx/templates/light/bloom-glow/pass1.frag +50 -0
- package/skills/agentvfx/templates/light/bloom-glow/pass2.frag +44 -0
- package/skills/agentvfx/templates/light/bloom-glow/pass3.frag +32 -0
- package/skills/agentvfx/templates/light/bloom-glow/pass4.frag +48 -0
- package/skills/agentvfx/templates/light/bloom-glow/pass5.frag +46 -0
- package/skills/agentvfx/templates/light/god-rays/demo-golden-hour.json +10 -0
- package/skills/agentvfx/templates/light/god-rays/demo-point-lamp.json +10 -0
- package/skills/agentvfx/templates/light/god-rays/fx.json +39 -0
- package/skills/agentvfx/templates/light/god-rays/main.frag +54 -0
- package/skills/agentvfx/templates/light/lens-flare/demo-clip01-bar.json +11 -0
- package/skills/agentvfx/templates/light/lens-flare/demo-eye-bar.json +10 -0
- package/skills/agentvfx/templates/light/lens-flare/demo-sun-ghosts.json +10 -0
- package/skills/agentvfx/templates/light/lens-flare/fx.json +49 -0
- package/skills/agentvfx/templates/light/lens-flare/main.frag +86 -0
- package/skills/agentvfx/templates/light/lens-flare/pass0.frag +24 -0
- package/skills/agentvfx/templates/light/light-leak/demo-slit.json +10 -0
- package/skills/agentvfx/templates/light/light-leak/demo-vintage-burn.json +10 -0
- package/skills/agentvfx/templates/light/light-leak/fx.json +40 -0
- package/skills/agentvfx/templates/light/light-leak/main.frag +46 -0
- package/skills/agentvfx/templates/light/light-stage/fx.json +29 -0
- package/skills/agentvfx/templates/light/light-stage/main.frag +56 -0
- package/skills/agentvfx/templates/light/light-sweep/demo-hard-bar.json +12 -0
- package/skills/agentvfx/templates/light/light-sweep/demo-logo-sweep.json +10 -0
- package/skills/agentvfx/templates/light/light-sweep/demo-onset.json +11 -0
- package/skills/agentvfx/templates/light/light-sweep/fx.json +45 -0
- package/skills/agentvfx/templates/light/light-sweep/main.frag +29 -0
- package/skills/agentvfx/templates/light/light-sweep/pass0.frag +17 -0
- package/skills/agentvfx/templates/light/light-sweep/pass1.frag +15 -0
- package/skills/agentvfx/templates/light/neon-saber/demo-hairline.json +10 -0
- package/skills/agentvfx/templates/light/neon-saber/demo-saber-laser.json +10 -0
- package/skills/agentvfx/templates/light/neon-saber/fx.json +48 -0
- package/skills/agentvfx/templates/light/neon-saber/main.frag +27 -0
- package/skills/agentvfx/templates/light/neon-saber/pass0.frag +46 -0
- package/skills/agentvfx/templates/light/neon-saber/pass1.frag +15 -0
- package/skills/agentvfx/templates/psychedelic/echo-flow/demo-trail.json +1 -0
- package/skills/agentvfx/templates/psychedelic/echo-flow/fx.json +38 -0
- package/skills/agentvfx/templates/psychedelic/echo-flow/main.frag +19 -0
- package/skills/agentvfx/templates/psychedelic/echo-flow/pass0.frag +16 -0
- package/skills/agentvfx/templates/psychedelic/echo-flow/pass1.frag +20 -0
- package/skills/agentvfx/templates/psychedelic/echo-flow/pass2.frag +11 -0
- package/skills/agentvfx/templates/psychedelic/echo-flow/pass3.frag +4 -0
- package/skills/agentvfx/templates/psychedelic/hologram-scan/demo-cyan.json +1 -0
- package/skills/agentvfx/templates/psychedelic/hologram-scan/fx.json +36 -0
- package/skills/agentvfx/templates/psychedelic/hologram-scan/main.frag +30 -0
- package/skills/agentvfx/templates/psychedelic/kaleido-fold/demo-six.json +1 -0
- package/skills/agentvfx/templates/psychedelic/kaleido-fold/fx.json +37 -0
- package/skills/agentvfx/templates/psychedelic/kaleido-fold/main.frag +10 -0
- package/skills/agentvfx/templates/psychedelic/kaleido-fold/pass0.frag +34 -0
- package/skills/agentvfx/templates/psychedelic/mosh-melt/demo-classic.json +1 -0
- package/skills/agentvfx/templates/psychedelic/mosh-melt/fx.json +38 -0
- package/skills/agentvfx/templates/psychedelic/mosh-melt/main.frag +20 -0
- package/skills/agentvfx/templates/psychedelic/mosh-melt/pass0.frag +22 -0
- package/skills/agentvfx/templates/psychedelic/sacred/NOTES.md +13 -0
- package/skills/agentvfx/templates/psychedelic/sacred/demo-classic.json +1 -0
- package/skills/agentvfx/templates/psychedelic/sacred/demo-halo.json +1 -0
- package/skills/agentvfx/templates/psychedelic/sacred/demo-slow-tide.json +1 -0
- package/skills/agentvfx/templates/psychedelic/sacred/demo-thermal.json +1 -0
- package/skills/agentvfx/templates/psychedelic/sacred/fx.json +263 -0
- package/skills/agentvfx/templates/psychedelic/sacred/main.frag +109 -0
- package/skills/agentvfx/templates/psychedelic/sacred/pass0.frag +25 -0
- package/skills/agentvfx/templates/psychedelic/sacred/pass1.frag +23 -0
- package/skills/agentvfx/templates/psychedelic/tidal-bands/demo-classic.json +1 -0
- package/skills/agentvfx/templates/psychedelic/tidal-bands/fx.json +37 -0
- package/skills/agentvfx/templates/psychedelic/tidal-bands/main.frag +54 -0
- package/skills/agentvfx/templates/scope/_chrome.glsl +242 -0
- package/skills/agentvfx/templates/scope/goniometer/demo-boot-green.json +1 -0
- package/skills/agentvfx/templates/scope/goniometer/demo-field-lime.json +1 -0
- package/skills/agentvfx/templates/scope/goniometer/demo-field-ultramarine.json +1 -0
- package/skills/agentvfx/templates/scope/goniometer/demo-glow-phosphor.json +1 -0
- package/skills/agentvfx/templates/scope/goniometer/demo-hud-black.json +1 -0
- package/skills/agentvfx/templates/scope/goniometer/fx.json +635 -0
- package/skills/agentvfx/templates/scope/goniometer/main.frag +33 -0
- package/skills/agentvfx/templates/scope/goniometer/pass0.frag +58 -0
- package/skills/agentvfx/templates/scope/goniometer/pass1.frag +43 -0
- package/skills/agentvfx/templates/scope/goniometer/pass2.frag +12 -0
- package/skills/agentvfx/templates/scope/goniometer/pass3.frag +12 -0
- package/skills/agentvfx/templates/scope/goniometer/pass4.frag +12 -0
- package/skills/agentvfx/templates/scope/goniometer/pass5.frag +12 -0
- package/skills/agentvfx/templates/scope/goniometer/pass6.frag +251 -0
- package/skills/agentvfx/templates/scope/scope-polar/demo-boot-green.json +1 -0
- package/skills/agentvfx/templates/scope/scope-polar/demo-field-lime.json +1 -0
- package/skills/agentvfx/templates/scope/scope-polar/demo-field-ultramarine.json +1 -0
- package/skills/agentvfx/templates/scope/scope-polar/demo-glow-phosphor.json +1 -0
- package/skills/agentvfx/templates/scope/scope-polar/demo-hud-black.json +1 -0
- package/skills/agentvfx/templates/scope/scope-polar/fx.json +686 -0
- package/skills/agentvfx/templates/scope/scope-polar/main.frag +39 -0
- package/skills/agentvfx/templates/scope/scope-polar/pass0.frag +84 -0
- package/skills/agentvfx/templates/scope/scope-polar/pass1.frag +49 -0
- package/skills/agentvfx/templates/scope/scope-polar/pass2.frag +12 -0
- package/skills/agentvfx/templates/scope/scope-polar/pass3.frag +12 -0
- package/skills/agentvfx/templates/scope/scope-polar/pass4.frag +12 -0
- package/skills/agentvfx/templates/scope/scope-polar/pass5.frag +12 -0
- package/skills/agentvfx/templates/scope/scope-polar/pass6.frag +251 -0
- package/skills/agentvfx/templates/scope/scope-triggered/demo-boot-green.json +1 -0
- package/skills/agentvfx/templates/scope/scope-triggered/demo-field-lime.json +1 -0
- package/skills/agentvfx/templates/scope/scope-triggered/demo-field-ultramarine.json +1 -0
- package/skills/agentvfx/templates/scope/scope-triggered/demo-glow-phosphor.json +1 -0
- package/skills/agentvfx/templates/scope/scope-triggered/demo-hud-black.json +1 -0
- package/skills/agentvfx/templates/scope/scope-triggered/fx.json +712 -0
- package/skills/agentvfx/templates/scope/scope-triggered/main.frag +36 -0
- package/skills/agentvfx/templates/scope/scope-triggered/pass0.frag +78 -0
- package/skills/agentvfx/templates/scope/scope-triggered/pass1.frag +50 -0
- package/skills/agentvfx/templates/scope/scope-triggered/pass2.frag +12 -0
- package/skills/agentvfx/templates/scope/scope-triggered/pass3.frag +12 -0
- package/skills/agentvfx/templates/scope/scope-triggered/pass4.frag +12 -0
- package/skills/agentvfx/templates/scope/scope-triggered/pass5.frag +12 -0
- package/skills/agentvfx/templates/scope/scope-triggered/pass6.frag +251 -0
- package/skills/agentvfx/templates/scope/spectrogram-scroll/demo-boot-green.json +1 -0
- package/skills/agentvfx/templates/scope/spectrogram-scroll/demo-field-lime.json +1 -0
- package/skills/agentvfx/templates/scope/spectrogram-scroll/demo-field-ultramarine.json +1 -0
- package/skills/agentvfx/templates/scope/spectrogram-scroll/demo-glow-phosphor.json +1 -0
- package/skills/agentvfx/templates/scope/spectrogram-scroll/demo-hud-black.json +1 -0
- package/skills/agentvfx/templates/scope/spectrogram-scroll/fx.json +595 -0
- package/skills/agentvfx/templates/scope/spectrogram-scroll/main.frag +83 -0
- package/skills/agentvfx/templates/scope/spectrogram-scroll/pass0.frag +52 -0
- package/skills/agentvfx/templates/scope/spectrogram-scroll/pass1.frag +251 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/demo-boot-green.json +1 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/demo-field-lime.json +1 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/demo-field-ultramarine.json +1 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/demo-glow-phosphor.json +1 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/demo-hud-black.json +1 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/fx.json +642 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/main.frag +33 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/pass0.frag +56 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/pass1.frag +44 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/pass2.frag +12 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/pass3.frag +12 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/pass4.frag +12 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/pass5.frag +12 -0
- package/skills/agentvfx/templates/scope/xy-phosphor/pass6.frag +251 -0
- package/skills/agentvfx/templates/spectrum/_src/bars-linear/fx.src.json +61 -0
- package/skills/agentvfx/templates/spectrum/_src/bars-linear/main.src.frag +112 -0
- package/skills/agentvfx/templates/spectrum/_src/bars-linear/pass0.src.frag +2 -0
- package/skills/agentvfx/templates/spectrum/_src/bars-mirror/fx.src.json +51 -0
- package/skills/agentvfx/templates/spectrum/_src/bars-mirror/main.src.frag +72 -0
- package/skills/agentvfx/templates/spectrum/_src/bars-mirror/pass0.src.frag +2 -0
- package/skills/agentvfx/templates/spectrum/_src/bass-circle/fx.src.json +56 -0
- package/skills/agentvfx/templates/spectrum/_src/bass-circle/main.src.frag +136 -0
- package/skills/agentvfx/templates/spectrum/_src/bass-circle/pass0.src.frag +2 -0
- package/skills/agentvfx/templates/spectrum/_src/build.mjs +68 -0
- package/skills/agentvfx/templates/spectrum/_src/label-bars/fx.src.json +54 -0
- package/skills/agentvfx/templates/spectrum/_src/label-bars/main.src.frag +102 -0
- package/skills/agentvfx/templates/spectrum/_src/label-bars/pass0.src.frag +2 -0
- package/skills/agentvfx/templates/spectrum/_src/shared/bars-fn.glsl +64 -0
- package/skills/agentvfx/templates/spectrum/_src/shared/bars-pass.glsl +22 -0
- package/skills/agentvfx/templates/spectrum/_src/shared/clock.glsl +7 -0
- package/skills/agentvfx/templates/spectrum/_src/shared/hud.glsl +50 -0
- package/skills/agentvfx/templates/spectrum/_src/shared/stage.glsl +74 -0
- package/skills/agentvfx/templates/spectrum/_src/spectrum-particles/fx.src.json +58 -0
- package/skills/agentvfx/templates/spectrum/_src/spectrum-particles/main.src.frag +119 -0
- package/skills/agentvfx/templates/spectrum/_src/spectrum-particles/pass0.src.frag +33 -0
- package/skills/agentvfx/templates/spectrum/_src/spectrum-radial/fx.src.json +56 -0
- package/skills/agentvfx/templates/spectrum/_src/spectrum-radial/main.src.frag +95 -0
- package/skills/agentvfx/templates/spectrum/_src/spectrum-radial/pass0.src.frag +2 -0
- package/skills/agentvfx/templates/spectrum/_src/waveform-line/fx.src.json +60 -0
- package/skills/agentvfx/templates/spectrum/_src/waveform-line/main.src.frag +98 -0
- package/skills/agentvfx/templates/spectrum/_src/waveform-line/pass0.src.frag +43 -0
- package/skills/agentvfx/templates/spectrum/bars-linear/demo-graph-acid.json +1 -0
- package/skills/agentvfx/templates/spectrum/bars-linear/demo-graph-black.json +1 -0
- package/skills/agentvfx/templates/spectrum/bars-linear/fx.json +632 -0
- package/skills/agentvfx/templates/spectrum/bars-linear/main.frag +233 -0
- package/skills/agentvfx/templates/spectrum/bars-linear/pass0.frag +91 -0
- package/skills/agentvfx/templates/spectrum/bars-mirror/demo-field-acid.json +1 -0
- package/skills/agentvfx/templates/spectrum/bars-mirror/demo-field-ultramarine.json +1 -0
- package/skills/agentvfx/templates/spectrum/bars-mirror/fx.json +539 -0
- package/skills/agentvfx/templates/spectrum/bars-mirror/main.frag +193 -0
- package/skills/agentvfx/templates/spectrum/bars-mirror/pass0.frag +91 -0
- package/skills/agentvfx/templates/spectrum/bass-circle/demo-bracket-black.json +1 -0
- package/skills/agentvfx/templates/spectrum/bass-circle/demo-bracket-ultramarine.json +1 -0
- package/skills/agentvfx/templates/spectrum/bass-circle/fx.json +552 -0
- package/skills/agentvfx/templates/spectrum/bass-circle/main.frag +258 -0
- package/skills/agentvfx/templates/spectrum/bass-circle/pass0.frag +91 -0
- package/skills/agentvfx/templates/spectrum/label-bars/demo-deck-black.json +1 -0
- package/skills/agentvfx/templates/spectrum/label-bars/demo-deck-ultramarine.json +1 -0
- package/skills/agentvfx/templates/spectrum/label-bars/fx.json +552 -0
- package/skills/agentvfx/templates/spectrum/label-bars/main.frag +223 -0
- package/skills/agentvfx/templates/spectrum/label-bars/pass0.frag +91 -0
- package/skills/agentvfx/templates/spectrum/spectrum-particles/demo-cloud-black.json +1 -0
- package/skills/agentvfx/templates/spectrum/spectrum-particles/demo-cloud-ultramarine.json +1 -0
- package/skills/agentvfx/templates/spectrum/spectrum-particles/fx.json +584 -0
- package/skills/agentvfx/templates/spectrum/spectrum-particles/main.frag +240 -0
- package/skills/agentvfx/templates/spectrum/spectrum-particles/pass0.frag +101 -0
- package/skills/agentvfx/templates/spectrum/spectrum-radial/demo-starburst-black.json +1 -0
- package/skills/agentvfx/templates/spectrum/spectrum-radial/demo-starburst-ultramarine.json +1 -0
- package/skills/agentvfx/templates/spectrum/spectrum-radial/fx.json +566 -0
- package/skills/agentvfx/templates/spectrum/spectrum-radial/main.frag +217 -0
- package/skills/agentvfx/templates/spectrum/spectrum-radial/pass0.frag +91 -0
- package/skills/agentvfx/templates/spectrum/waveform-line/demo-strip-acid.json +1 -0
- package/skills/agentvfx/templates/spectrum/waveform-line/demo-strip-black.json +1 -0
- package/skills/agentvfx/templates/spectrum/waveform-line/fx.json +481 -0
- package/skills/agentvfx/templates/spectrum/waveform-line/main.frag +219 -0
- package/skills/agentvfx/templates/spectrum/waveform-line/pass0.frag +48 -0
- package/skills/agentvfx/templates/spectrum/waveform-line/pass1.frag +86 -0
- package/skills/agentvfx/test/_render_light.mjs +38 -0
- package/skills/agentvfx/test/audio-stereo.test.mjs +45 -0
- package/skills/agentvfx/test/audio.test.mjs +257 -0
- package/skills/agentvfx/test/brutal.test.mjs +190 -0
- package/skills/agentvfx/test/concept-collage-layout.test.mjs +236 -0
- package/skills/agentvfx/test/concept-collage-scenes.test.mjs +305 -0
- package/skills/agentvfx/test/concept-collage-typefx.test.mjs +153 -0
- package/skills/agentvfx/test/concept-collage.test.mjs +84 -0
- package/skills/agentvfx/test/concept-lattice.test.mjs +133 -0
- package/skills/agentvfx/test/concept-signal-cut.test.mjs +172 -0
- package/skills/agentvfx/test/credit-overlay.test.mjs +58 -0
- package/skills/agentvfx/test/credit.test.mjs +42 -0
- package/skills/agentvfx/test/doctor.test.mjs +31 -0
- package/skills/agentvfx/test/encode.test.mjs +22 -0
- package/skills/agentvfx/test/fixtures/r7-collage-LAYOUTS.json +5780 -0
- package/skills/agentvfx/test/fixtures/score-bad-duration.json +7 -0
- package/skills/agentvfx/test/fixtures/score-bad-safety.json +8 -0
- package/skills/agentvfx/test/fixtures/score-identity-footage.json +8 -0
- package/skills/agentvfx/test/fixtures/score-missing-template.json +7 -0
- package/skills/agentvfx/test/fixtures/score-ok.json +8 -0
- package/skills/agentvfx/test/fixtures/score-strobe-12hz.json +8 -0
- package/skills/agentvfx/test/fixtures/score-text-probe.json +1 -0
- package/skills/agentvfx/test/flash-audit.test.mjs +150 -0
- package/skills/agentvfx/test/flash.test.mjs +83 -0
- package/skills/agentvfx/test/footage.test.mjs +88 -0
- package/skills/agentvfx/test/glitch.test.mjs +272 -0
- package/skills/agentvfx/test/impact.test.mjs +231 -0
- package/skills/agentvfx/test/imports.test.mjs +39 -0
- package/skills/agentvfx/test/light.test.mjs +200 -0
- package/skills/agentvfx/test/loop.test.mjs +80 -0
- package/skills/agentvfx/test/psychedelic.test.mjs +99 -0
- package/skills/agentvfx/test/render.test.mjs +73 -0
- package/skills/agentvfx/test/sacred.test.mjs +175 -0
- package/skills/agentvfx/test/schema.test.mjs +103 -0
- package/skills/agentvfx/test/scope.test.mjs +306 -0
- package/skills/agentvfx/test/spectrum.test.mjs +165 -0
- package/skills/agentvfx/test/text.test.mjs +142 -0
- package/skills/agentvfx/test/web.test.mjs +397 -0
- package/skills/agentvfx/test-media/SOURCES.md +39 -0
- package/skills/agentvfx/test-media/beat-132.mp3 +0 -0
- package/skills/agentvfx/test-media/clip-01.mp4 +0 -0
- package/skills/agentvfx/test-media/clip-02.mp4 +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { test } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { mkdtempSync, rmSync, existsSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { loadLibrary } from "../engine/core/templates.mjs";
|
|
7
|
+
import { validateScore } from "../engine/core/validate.mjs";
|
|
8
|
+
import { buildSchedule } from "../engine/core/schedule.mjs";
|
|
9
|
+
import { renderScore } from "../engine/node/render.mjs";
|
|
10
|
+
|
|
11
|
+
const lib = loadLibrary({ includeTest: true });
|
|
12
|
+
const W = 256;
|
|
13
|
+
const H = 144;
|
|
14
|
+
const score = (extra) => {
|
|
15
|
+
const r = validateScore({ version: 1, durationSec: 3, seed: 5, out: "t", ...extra }, lib);
|
|
16
|
+
assert.equal(r.ok, true, JSON.stringify(r.errors));
|
|
17
|
+
return r.value;
|
|
18
|
+
};
|
|
19
|
+
const centre = (rgba) => {
|
|
20
|
+
const o = ((H >> 1) * W + (W >> 1)) * 4;
|
|
21
|
+
return [rgba[o], rgba[o + 1], rgba[o + 2]];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
async function renderCentres(s, { replay = false, probe = false } = {}) {
|
|
25
|
+
const dir = mkdtempSync(path.join(tmpdir(), "agentvfx-test-"));
|
|
26
|
+
const px = [];
|
|
27
|
+
const shas = [];
|
|
28
|
+
try {
|
|
29
|
+
const report = await renderScore(s, lib, { outDir: dir, width: W, height: H, replay, probeNondeterminism: probe, onFrame: (f, a) => { px[f] = centre(a.rgba); shas[f] = a.rgbaSha256; } });
|
|
30
|
+
assert.ok(existsSync(path.join(dir, "film.mp4")));
|
|
31
|
+
return { report, px, shas };
|
|
32
|
+
} finally {
|
|
33
|
+
rmSync(dir, { recursive: true, force: true });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
test("persistent buffer: feedback-counter shows frame 30 as 31/255 (+-1)", async () => {
|
|
38
|
+
const { px, report } = await renderCentres(score({ template: "test-feedback-counter", preset: "one" }), { replay: true });
|
|
39
|
+
assert.ok(Math.abs(px[30][0] - 31) <= 1, `frame 30 = ${px[30]}`);
|
|
40
|
+
assert.ok(Math.abs(px[0][0] - 1) <= 1, `frame 0 = ${px[0]}`);
|
|
41
|
+
assert.equal(report.determinism.pass, true);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test("determinism replay fails on a page with an unseeded random input", async () => {
|
|
45
|
+
const { report } = await renderCentres(score({ template: "test-gradient", params: { speed: 1 } }), { replay: true, probe: true });
|
|
46
|
+
assert.equal(report.determinism.pass, false);
|
|
47
|
+
assert.ok(report.determinism.firstDifference, "names the first differing block");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("a stack gradient -> identity renders byte-identical twice", async () => {
|
|
51
|
+
const s = score({ template: "test-gradient", stack: ["test-identity"] });
|
|
52
|
+
const a = await renderCentres(s);
|
|
53
|
+
const b = await renderCentres(s);
|
|
54
|
+
assert.deepEqual(a.shas, b.shas);
|
|
55
|
+
assert.notDeepEqual(a.px[10], [0, 0, 0], "identity passes the gradient through");
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("a hit at t=1.0 is active on frames 30..30+d-1 exactly", async () => {
|
|
59
|
+
const s = score({ template: "test-gradient", params: { tint: [0.1, 0.1, 0.9, 1] }, hits: [{ t: 1, template: "test-strobe", preset: "hold", durationFrames: 4 }] });
|
|
60
|
+
const sched = buildSchedule(s, lib);
|
|
61
|
+
const hitFrames = sched.frames.map((fr, f) => (fr.layers.some((l) => l.key === "h0") ? f : -1)).filter((f) => f >= 0);
|
|
62
|
+
assert.deepEqual(hitFrames, [30, 31, 32, 33]);
|
|
63
|
+
const { px } = await renderCentres(s);
|
|
64
|
+
for (const f of [30, 31, 32, 33]) assert.deepEqual(px[f].map((v) => v > 250), [true, true, true], `frame ${f} white: ${px[f]}`);
|
|
65
|
+
for (const f of [29, 34]) assert.ok(px[f][0] < 200, `frame ${f} not white: ${px[f]}`);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("a cut at t=2.0 switches layers exactly on frame 60", async () => {
|
|
69
|
+
const s = score({ template: "test-gradient", params: { tint: [0.1, 0.1, 0.9, 1] }, cuts: [{ t: 2, layers: [{ template: "test-strobe", preset: "hold", params: { red: true } }] }] });
|
|
70
|
+
const { px } = await renderCentres(s);
|
|
71
|
+
assert.ok(px[60][0] > 250 && px[60][1] < 5 && px[60][2] < 5, `frame 60 red: ${px[60]}`);
|
|
72
|
+
assert.ok(!(px[59][0] > 250 && px[59][1] < 5), `frame 59 not red: ${px[59]}`);
|
|
73
|
+
});
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { test } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { loadLibrary } from "../engine/core/templates.mjs";
|
|
8
|
+
import { validateScore } from "../engine/core/validate.mjs";
|
|
9
|
+
import { renderScore } from "../engine/node/render.mjs";
|
|
10
|
+
import { openFootage } from "../engine/node/footage.mjs";
|
|
11
|
+
import { analyzeAudio } from "../engine/node/audio.mjs";
|
|
12
|
+
import { auditFlash } from "../engine/core/flash.mjs";
|
|
13
|
+
|
|
14
|
+
const lib = loadLibrary();
|
|
15
|
+
const W = 320;
|
|
16
|
+
const H = 180;
|
|
17
|
+
|
|
18
|
+
function hsv(r, g, b) {
|
|
19
|
+
const max = Math.max(r, g, b);
|
|
20
|
+
const min = Math.min(r, g, b);
|
|
21
|
+
const d = max - min;
|
|
22
|
+
let h = 0;
|
|
23
|
+
if (d > 0) {
|
|
24
|
+
if (max === r) h = ((g - b) / d) % 6;
|
|
25
|
+
else if (max === g) h = (b - r) / d + 2;
|
|
26
|
+
else h = (r - g) / d + 4;
|
|
27
|
+
}
|
|
28
|
+
return { h: (h * 60 + 360) % 360, s: max === 0 ? 0 : d / max };
|
|
29
|
+
}
|
|
30
|
+
const hueDiff = (a, b) => Math.min(Math.abs(a - b), 360 - Math.abs(a - b));
|
|
31
|
+
|
|
32
|
+
async function renderClip(clip, preset, frames) {
|
|
33
|
+
const dir = mkdtempSync(path.join(tmpdir(), "agentvfx-sacred-"));
|
|
34
|
+
const v = validateScore({ version: 1, template: "sacred", preset, input: { video: clip }, durationSec: 3, seed: 11, out: "s" }, lib);
|
|
35
|
+
assert.equal(v.ok, true, JSON.stringify(v.errors));
|
|
36
|
+
const footage = openFootage(clip, { fps: 30, durationSec: 3, longEdge: W });
|
|
37
|
+
const kept = new Map();
|
|
38
|
+
try {
|
|
39
|
+
const report = await renderScore(v.value, lib, { outDir: dir, width: W, height: H, footage, replay: true, onFrame: (f, a) => { if (frames.includes(f)) kept.set(f, Buffer.from(a.rgba)); } });
|
|
40
|
+
return { report, kept };
|
|
41
|
+
} finally {
|
|
42
|
+
footage.close();
|
|
43
|
+
rmSync(dir, { recursive: true, force: true });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function makeClip(dir, lavfi) {
|
|
48
|
+
const clip = path.join(dir, "in.mp4");
|
|
49
|
+
const r = spawnSync("ffmpeg", ["-v", "error", "-y", "-f", "lavfi", "-i", lavfi, "-t", "4", "-c:v", "libx264", "-pix_fmt", "yuv420p", clip], { encoding: "utf8" });
|
|
50
|
+
assert.equal(r.status, 0, r.stderr);
|
|
51
|
+
return clip;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
for (const preset of ["sacred-classic", "sacred-slow-tide"]) {
|
|
55
|
+
test(`${preset}: the colour tide moves over time on still footage, saturated, deterministic`, async () => {
|
|
56
|
+
const tmp = mkdtempSync(path.join(tmpdir(), "agentvfx-sacred-src-"));
|
|
57
|
+
try {
|
|
58
|
+
const clip = makeClip(tmp, `testsrc2=size=${W}x${H}:rate=30,trim=end_frame=1,loop=loop=-1:size=1`);
|
|
59
|
+
const { report, kept } = await renderClip(clip, preset, [0, 60]);
|
|
60
|
+
assert.equal(report.determinism.pass, true);
|
|
61
|
+
const a = kept.get(0);
|
|
62
|
+
const b = kept.get(60);
|
|
63
|
+
let dh = 0;
|
|
64
|
+
let sat = 0;
|
|
65
|
+
let n = 0;
|
|
66
|
+
for (let i = 0; i < W * H; i += 7) {
|
|
67
|
+
const o = i * 4;
|
|
68
|
+
const ha = hsv(a[o], a[o + 1], a[o + 2]);
|
|
69
|
+
const hb = hsv(b[o], b[o + 1], b[o + 2]);
|
|
70
|
+
dh += hueDiff(ha.h, hb.h);
|
|
71
|
+
sat += hb.s;
|
|
72
|
+
n += 1;
|
|
73
|
+
}
|
|
74
|
+
assert.ok(dh / n > 30, `mean hue change ${(dh / n).toFixed(1)} deg`);
|
|
75
|
+
// Plan said >= 0.6; lowered to 0.45 after the user's look-gate round 1 ("Saturation 이 너무 심함").
|
|
76
|
+
assert.ok(sat / n >= 0.45, `mean saturation ${(sat / n).toFixed(2)}`);
|
|
77
|
+
} finally {
|
|
78
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// sacred-thermal and sacred-halo use the "print" palette: four hard screenprint steps (ink, acid,
|
|
84
|
+
// signal orange, paper), dark luma stays ink, and halo adds a thick acid stroke over a dimmed grey base.
|
|
85
|
+
// They are checked for that look instead of the hue cycling and saturation the cyclic presets carry.
|
|
86
|
+
const isBlueField = (r, g, b) => b > r + 40 && b > g + 20;
|
|
87
|
+
const isAcid = (r, g, b) => g > 200 && b < 80 && r < 220 && g - r > 30;
|
|
88
|
+
|
|
89
|
+
for (const preset of ["sacred-thermal", "sacred-halo"]) {
|
|
90
|
+
test(`${preset}: print palette, no blue field, the bands move over time, deterministic`, async () => {
|
|
91
|
+
const tmp = mkdtempSync(path.join(tmpdir(), "agentvfx-sacred-src-"));
|
|
92
|
+
try {
|
|
93
|
+
const clip = makeClip(tmp, `testsrc2=size=${W}x${H}:rate=30,trim=end_frame=1,loop=loop=-1:size=1`);
|
|
94
|
+
const { report, kept } = await renderClip(clip, preset, [0, 60]);
|
|
95
|
+
assert.equal(report.determinism.pass, true);
|
|
96
|
+
const a = kept.get(0);
|
|
97
|
+
const b = kept.get(60);
|
|
98
|
+
let n = 0;
|
|
99
|
+
let moved = 0;
|
|
100
|
+
let blue = 0;
|
|
101
|
+
let acid = 0;
|
|
102
|
+
let baseSat = 0;
|
|
103
|
+
let baseN = 0;
|
|
104
|
+
const bins = new Map();
|
|
105
|
+
for (let i = 0; i < W * H; i += 3) {
|
|
106
|
+
const o = i * 4;
|
|
107
|
+
const [r, g, bl] = [b[o], b[o + 1], b[o + 2]];
|
|
108
|
+
n += 1;
|
|
109
|
+
if (Math.abs(a[o] - r) + Math.abs(a[o + 1] - g) + Math.abs(a[o + 2] - bl) > 60) moved += 1;
|
|
110
|
+
if (isBlueField(r, g, bl)) blue += 1;
|
|
111
|
+
if (isAcid(r, g, bl)) acid += 1;
|
|
112
|
+
else { baseSat += hsv(r, g, bl).s; baseN += 1; }
|
|
113
|
+
const k = `${r >> 5},${g >> 5},${bl >> 5}`;
|
|
114
|
+
bins.set(k, (bins.get(k) || 0) + 1);
|
|
115
|
+
}
|
|
116
|
+
assert.ok(blue / n < 0.01, `blue-field share ${(blue / n).toFixed(3)}`);
|
|
117
|
+
assert.ok(moved / n > 0.05, `moved share ${(moved / n).toFixed(3)}`);
|
|
118
|
+
if (preset === "sacred-thermal") {
|
|
119
|
+
const top4 = [...bins.values()].sort((x, y) => y - x).slice(0, 4).reduce((x, y) => x + y, 0);
|
|
120
|
+
assert.ok(top4 / n > 0.85, `top-4 colour share ${(top4 / n).toFixed(3)}`);
|
|
121
|
+
} else {
|
|
122
|
+
assert.ok(acid / n > 0.05, `acid stroke share ${(acid / n).toFixed(3)}`);
|
|
123
|
+
assert.ok(baseSat / baseN < 0.3, `base saturation ${(baseSat / baseN).toFixed(2)}`);
|
|
124
|
+
}
|
|
125
|
+
} finally {
|
|
126
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
test("on flat grey footage, opposite edges of one frame differ in hue (spatial tide)", async () => {
|
|
132
|
+
const tmp = mkdtempSync(path.join(tmpdir(), "agentvfx-sacred-src-"));
|
|
133
|
+
try {
|
|
134
|
+
const clip = makeClip(tmp, `color=gray:size=${W}x${H}:rate=30`);
|
|
135
|
+
const { kept } = await renderClip(clip, "sacred-classic", [45]);
|
|
136
|
+
const f = kept.get(45);
|
|
137
|
+
const meanHue = (x0, x1) => {
|
|
138
|
+
let sx = 0;
|
|
139
|
+
let sy = 0;
|
|
140
|
+
for (let y = 20; y < H - 20; y += 4) for (let x = x0; x < x1; x += 2) {
|
|
141
|
+
const o = (y * W + x) * 4;
|
|
142
|
+
const h = (hsv(f[o], f[o + 1], f[o + 2]).h * Math.PI) / 180;
|
|
143
|
+
sx += Math.cos(h);
|
|
144
|
+
sy += Math.sin(h);
|
|
145
|
+
}
|
|
146
|
+
return ((Math.atan2(sy, sx) * 180) / Math.PI + 360) % 360;
|
|
147
|
+
};
|
|
148
|
+
const d = hueDiff(meanHue(0, 30), meanHue(W - 30, W));
|
|
149
|
+
assert.ok(d > 20, `edge hue difference ${d.toFixed(1)} deg`);
|
|
150
|
+
} finally {
|
|
151
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// Bass drives the tide speed under audioKick, so this is the same speed change per frame that a moving slider
|
|
156
|
+
// makes live. The hard print bands must not turn it into whole-frame ink/paper flips.
|
|
157
|
+
test("print palette: a speed that changes every frame and a maxed tide stay inside the flash limits", async () => {
|
|
158
|
+
const dir = mkdtempSync(path.join(tmpdir(), "agentvfx-sacred-flash-"));
|
|
159
|
+
const music = path.resolve("test-media/beat-132.mp3");
|
|
160
|
+
const clip = path.resolve("test-media/clip-01.mp4");
|
|
161
|
+
const params = { tideAmount: 3, tideSpeed: 3, tideScale: 0.1, tideWaves: 3, audioKick: 2 };
|
|
162
|
+
const v = validateScore({ version: 1, template: "sacred", preset: "sacred-thermal", params, input: { video: "test-media/clip-01.mp4", audio: "test-media/beat-132.mp3" }, durationSec: 5, seed: 11, out: "s" }, lib);
|
|
163
|
+
assert.equal(v.ok, true, JSON.stringify(v.errors));
|
|
164
|
+
const features = await analyzeAudio(music, { fps: 30, durationSec: 5 });
|
|
165
|
+
const footage = openFootage(clip, { fps: 30, durationSec: 5, longEdge: W });
|
|
166
|
+
const frames = [];
|
|
167
|
+
try {
|
|
168
|
+
await renderScore(v.value, lib, { outDir: dir, width: W, height: H, footage, features, replay: false, onFrame: (f, a) => { frames[f] = { width: W, height: H, data: Buffer.from(a.rgba) }; } });
|
|
169
|
+
} finally {
|
|
170
|
+
footage.close();
|
|
171
|
+
rmSync(dir, { recursive: true, force: true });
|
|
172
|
+
}
|
|
173
|
+
const audit = auditFlash(frames, { fps: 30 });
|
|
174
|
+
assert.equal(audit.exceeds, false, `worst ${audit.worstWindow.transitions} transitions in 1 s, red ${audit.redFlashes}`);
|
|
175
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { test } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { validateScore, validateTemplate } from "../engine/core/validate.mjs";
|
|
6
|
+
import { loadLibrary } from "../engine/core/templates.mjs";
|
|
7
|
+
|
|
8
|
+
const VFX = fileURLToPath(new URL("../scripts/vfx.mjs", import.meta.url));
|
|
9
|
+
const FIX = fileURLToPath(new URL("./fixtures/", import.meta.url));
|
|
10
|
+
const run = (args) => spawnSync(process.execPath, [VFX, ...args], { encoding: "utf8" });
|
|
11
|
+
const lib = loadLibrary({ includeTest: true });
|
|
12
|
+
|
|
13
|
+
const okScore = () => ({ version: 1, template: "test-gradient", durationSec: 4, seed: 7, out: "x" });
|
|
14
|
+
const paths = (r) => r.errors.map((e) => e.path);
|
|
15
|
+
|
|
16
|
+
const goodTemplate = () => ({
|
|
17
|
+
DESCRIPTION: "fixture", CATEGORIES: ["test"], ISFVSN: "2",
|
|
18
|
+
INPUTS: [{ NAME: "speed", TYPE: "float", MIN: 0, MAX: 4, DEFAULT: 1 }],
|
|
19
|
+
X_AGENTVFX: {
|
|
20
|
+
id: "fixture", family: "test", input: "generative", spdx: "MIT", flash: "none",
|
|
21
|
+
presets: { a: { speed: 1 }, b: { speed: 2 }, c: { speed: 3 } },
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("a valid score is accepted", () => {
|
|
26
|
+
const r = validateScore(okScore(), lib);
|
|
27
|
+
assert.deepEqual(r.errors, []);
|
|
28
|
+
assert.equal(r.ok, true);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("durationSec 8 is rejected naming durationSec", () => {
|
|
32
|
+
const r = validateScore({ ...okScore(), durationSec: 8 }, lib);
|
|
33
|
+
assert.equal(r.ok, false);
|
|
34
|
+
assert.ok(paths(r).includes("durationSec"), JSON.stringify(r.errors));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("an unknown template is rejected naming template", () => {
|
|
38
|
+
const r = validateScore({ ...okScore(), template: "nope-not-here" }, lib);
|
|
39
|
+
assert.ok(paths(r).includes("template"), JSON.stringify(r.errors));
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("an unknown safety.mode is rejected naming safety.mode", () => {
|
|
43
|
+
const r = validateScore({ ...okScore(), safety: { mode: "gentle" } }, lib);
|
|
44
|
+
assert.ok(paths(r).includes("safety.mode"), JSON.stringify(r.errors));
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("a score without safety resolves to stage mode", () => {
|
|
48
|
+
const r = validateScore(okScore(), lib);
|
|
49
|
+
assert.equal(r.value.safety.mode, "stage");
|
|
50
|
+
assert.equal(r.value.safety.safeVariant, false);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("unknown params, bad ranges, bindings and hits are named by path", () => {
|
|
54
|
+
const r = validateScore({
|
|
55
|
+
...okScore(), params: { nope: 1, speed: 99 },
|
|
56
|
+
bindings: [{ param: "speed", feature: "loudness", gain: 1, offset: 0 }],
|
|
57
|
+
hits: [{ t: 1, onset: 2, template: "test-gradient", durationFrames: 3 }],
|
|
58
|
+
unknownKey: true,
|
|
59
|
+
}, lib);
|
|
60
|
+
const p = paths(r);
|
|
61
|
+
for (const want of ["params.nope", "params.speed", "bindings[0].feature", "hits[0]", "unknownKey"]) assert.ok(p.includes(want), `${want} missing in ${JSON.stringify(p)}`);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("a template with spdx GPL-3.0 is rejected", () => {
|
|
65
|
+
const t = goodTemplate();
|
|
66
|
+
t.X_AGENTVFX.spdx = "GPL-3.0";
|
|
67
|
+
const r = validateTemplate(t, "fixture");
|
|
68
|
+
assert.ok(r.errors.some((e) => e.path === "X_AGENTVFX.spdx"), JSON.stringify(r.errors));
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("a template with fewer than 3 presets is rejected", () => {
|
|
72
|
+
const t = goodTemplate();
|
|
73
|
+
t.X_AGENTVFX.presets = { a: { speed: 1 }, b: { speed: 2 } };
|
|
74
|
+
const r = validateTemplate(t, "fixture");
|
|
75
|
+
assert.ok(r.errors.some((e) => e.path === "X_AGENTVFX.presets"), JSON.stringify(r.errors));
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("a good template passes and preset values are range-checked", () => {
|
|
79
|
+
assert.deepEqual(validateTemplate(goodTemplate(), "fixture").errors, []);
|
|
80
|
+
const t = goodTemplate();
|
|
81
|
+
t.X_AGENTVFX.presets.c.speed = 10;
|
|
82
|
+
assert.ok(validateTemplate(t, "fixture").errors.some((e) => e.path === "X_AGENTVFX.presets.c.speed"));
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("every library template validates", () => {
|
|
86
|
+
for (const [id, tpl] of lib) assert.deepEqual(validateTemplate(tpl.fx, id).errors, [], id);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("cli: validate accepts score-ok and rejects score-bad-duration naming durationSec", () => {
|
|
90
|
+
const ok = run(["validate", `${FIX}score-ok.json`]);
|
|
91
|
+
assert.equal(ok.status, 0, ok.stdout + ok.stderr);
|
|
92
|
+
const bad = run(["validate", `${FIX}score-bad-duration.json`]);
|
|
93
|
+
assert.notEqual(bad.status, 0);
|
|
94
|
+
assert.match(bad.stdout + bad.stderr, /durationSec/u);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test("cli: list hides test templates", () => {
|
|
98
|
+
const r = run(["list", "--json"]);
|
|
99
|
+
assert.equal(r.status, 0, r.stderr);
|
|
100
|
+
const rows = JSON.parse(r.stdout);
|
|
101
|
+
assert.ok(Array.isArray(rows));
|
|
102
|
+
assert.ok(!rows.some((t) => t.family === "_test" || t.id.startsWith("test-")));
|
|
103
|
+
});
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
// Task 10 (scope family): xy-phosphor, goniometer, scope-triggered, spectrogram-scroll, scope-polar.
|
|
2
|
+
// Synthetic WAVs are generated in os.tmpdir() and removed afterwards; renders are small (480x270 / 320x180).
|
|
3
|
+
import { test, after } from "node:test";
|
|
4
|
+
import assert from "node:assert/strict";
|
|
5
|
+
import { mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { loadLibrary } from "../engine/core/templates.mjs";
|
|
10
|
+
import { validateScore, validateTemplate } from "../engine/core/validate.mjs";
|
|
11
|
+
import { renderScore } from "../engine/node/render.mjs";
|
|
12
|
+
import { runJob } from "../engine/node/job.mjs";
|
|
13
|
+
import { analyzeAudio } from "../engine/node/audio.mjs";
|
|
14
|
+
|
|
15
|
+
const ROOT = path.resolve(fileURLToPath(new URL("..", import.meta.url)));
|
|
16
|
+
const lib = loadLibrary();
|
|
17
|
+
const IDS = ["scope-triggered", "xy-phosphor", "goniometer", "spectrogram-scroll", "scope-polar"];
|
|
18
|
+
const tmp = mkdtempSync(path.join(tmpdir(), "agentvfx-scope-"));
|
|
19
|
+
after(() => rmSync(tmp, { recursive: true, force: true }));
|
|
20
|
+
|
|
21
|
+
function wav(name, fn, seconds = 4, sr = 48000) {
|
|
22
|
+
const n = seconds * sr;
|
|
23
|
+
const data = Buffer.alloc(n * 4);
|
|
24
|
+
for (let i = 0; i < n; i++) {
|
|
25
|
+
const [l, r] = fn(i / sr);
|
|
26
|
+
data.writeInt16LE(Math.round(l * 32767), i * 4);
|
|
27
|
+
data.writeInt16LE(Math.round(r * 32767), i * 4 + 2);
|
|
28
|
+
}
|
|
29
|
+
const h = Buffer.alloc(44);
|
|
30
|
+
h.write("RIFF", 0); h.writeUInt32LE(36 + data.length, 4); h.write("WAVEfmt ", 8); h.writeUInt32LE(16, 16);
|
|
31
|
+
h.writeUInt16LE(1, 20); h.writeUInt16LE(2, 22); h.writeUInt32LE(sr, 24); h.writeUInt32LE(sr * 4, 28);
|
|
32
|
+
h.writeUInt16LE(4, 32); h.writeUInt16LE(16, 34); h.write("data", 36); h.writeUInt32LE(data.length, 40);
|
|
33
|
+
const file = path.join(tmp, name);
|
|
34
|
+
writeFileSync(file, Buffer.concat([h, data]));
|
|
35
|
+
return file;
|
|
36
|
+
}
|
|
37
|
+
const sine = (hz, a = 0.5) => (t) => { const v = a * Math.sin(2 * Math.PI * hz * t); return [v, v]; };
|
|
38
|
+
|
|
39
|
+
/** Render a score at W x H and keep the RGBA of the listed frames. */
|
|
40
|
+
async function render(score, { audio = null, W = 480, H = 270, frames = [] } = {}) {
|
|
41
|
+
const v = validateScore({ version: 1, durationSec: 3, seed: 5, out: "t", credit: { overlay: false }, ...score }, lib);
|
|
42
|
+
assert.equal(v.ok, true, JSON.stringify(v.errors));
|
|
43
|
+
const features = audio ? await analyzeAudio(audio, { fps: v.value.fps, durationSec: 3 }) : null;
|
|
44
|
+
const kept = new Map();
|
|
45
|
+
const dir = mkdtempSync(path.join(tmp, "r-"));
|
|
46
|
+
const report = await renderScore(v.value, lib, { outDir: dir, width: W, height: H, features, replay: false, onFrame: (f, a) => { if (frames.includes(f)) kept.set(f, Buffer.from(a.rgba)); } });
|
|
47
|
+
rmSync(dir, { recursive: true, force: true });
|
|
48
|
+
return { report, kept, W, H };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const px = (img, W, x, y) => { const o = (y * W + x) * 4; return [img[o], img[o + 1], img[o + 2]]; };
|
|
52
|
+
const peak = (c) => Math.max(c[0], c[1], c[2]);
|
|
53
|
+
const BARE = { hud: 0, bloom: 0, persistence: 0.5 };
|
|
54
|
+
const BARE_TRACE = { hud: 0, bloom: 0, persist: 0 };
|
|
55
|
+
const PRESETS = ["hud-black", "field-lime", "field-ultramarine", "boot-green", "glow-phosphor"];
|
|
56
|
+
|
|
57
|
+
function bbox(img, W, H, thr = 128) {
|
|
58
|
+
let x0 = W, y0 = H, x1 = -1, y1 = -1, n = 0;
|
|
59
|
+
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) if (peak(px(img, W, x, y)) >= thr) { n++; x0 = Math.min(x0, x); x1 = Math.max(x1, x); y0 = Math.min(y0, y); y1 = Math.max(y1, y); }
|
|
60
|
+
return { x0, y0, x1, y1, n, cx: (x0 + x1 + 1) / 2, cy: (y0 + y1 + 1) / 2, w: x1 - x0 + 1, h: y1 - y0 + 1 };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Number of background pixels inside the figure that the outside cannot reach (4-connected, mask dilated by 1 px). */
|
|
64
|
+
function enclosedArea(img, W, H, thr = 90) {
|
|
65
|
+
const on = new Uint8Array(W * H);
|
|
66
|
+
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) if (peak(px(img, W, x, y)) >= thr) for (let dy = -1; dy <= 1; dy++) for (let dx = -1; dx <= 1; dx++) { const xx = x + dx, yy = y + dy; if (xx >= 0 && yy >= 0 && xx < W && yy < H) on[yy * W + xx] = 1; }
|
|
67
|
+
const seen = new Uint8Array(W * H);
|
|
68
|
+
const stack = [0];
|
|
69
|
+
seen[0] = 1;
|
|
70
|
+
while (stack.length) {
|
|
71
|
+
const i = stack.pop();
|
|
72
|
+
const x = i % W, y = (i - x) / W;
|
|
73
|
+
for (const [nx, ny] of [[x + 1, y], [x - 1, y], [x, y + 1], [x, y - 1]]) {
|
|
74
|
+
if (nx < 0 || ny < 0 || nx >= W || ny >= H || seen[ny * W + nx] || on[ny * W + nx]) continue;
|
|
75
|
+
seen[ny * W + nx] = 1;
|
|
76
|
+
stack.push(ny * W + nx);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
let enclosed = 0;
|
|
80
|
+
for (let i = 0; i < W * H; i++) if (!on[i] && !seen[i]) enclosed++;
|
|
81
|
+
return enclosed;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
test("all five templates are valid, licensed, 60 fps, 3+ presets, honest flash and safeSubstitute; every demo score validates", () => {
|
|
85
|
+
for (const id of IDS) {
|
|
86
|
+
const t = lib.get(id);
|
|
87
|
+
assert.ok(t, `${id} missing from the library`);
|
|
88
|
+
const v = validateTemplate(t.fx, t.rel);
|
|
89
|
+
assert.equal(v.ok, true, `${id}: ${JSON.stringify(v.errors)}`);
|
|
90
|
+
const x = t.fx.X_AGENTVFX;
|
|
91
|
+
assert.equal(x.family, "scope");
|
|
92
|
+
assert.equal(x.fps, 60);
|
|
93
|
+
assert.equal(x.spdx, "LicenseRef-agentvfx");
|
|
94
|
+
assert.ok(Object.keys(x.presets).length >= 3, `${id} presets`);
|
|
95
|
+
for (const p of PRESETS) assert.ok(x.presets[p], `${id} lacks the ${p} preset`);
|
|
96
|
+
assert.ok(Array.isArray(x.text) && x.text.length >= 20, `${id} should label its panels with engine text`);
|
|
97
|
+
assert.ok(t.fx.INPUTS.some((i) => i.NAME === "fieldMode"), `${id} lacks fieldMode`);
|
|
98
|
+
assert.equal(t.fx.INPUTS.find((i) => i.NAME === "hud").DEFAULT, 1, `${id}: the HUD look must be the default`);
|
|
99
|
+
assert.ok(t.fx.INPUTS.find((i) => i.NAME === "bloom").DEFAULT <= 0.4, `${id}: default bloom must be subtle`);
|
|
100
|
+
if (x.flash !== "none") assert.ok(x.safeSubstitute, `${id} flashes but has no safeSubstitute`);
|
|
101
|
+
const demos = readdirSync(t.dir).filter((f) => /^demo-.*\.json$/u.test(f));
|
|
102
|
+
assert.ok(demos.length >= 1, `${id} has no demo`);
|
|
103
|
+
for (const d of demos) {
|
|
104
|
+
const score = JSON.parse(readFileSync(path.join(t.dir, d), "utf8"));
|
|
105
|
+
const r = validateScore(score, lib);
|
|
106
|
+
assert.equal(r.ok, true, `${id}/${d}: ${JSON.stringify(r.errors)}`);
|
|
107
|
+
assert.equal(score.durationSec, 4);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("xy-phosphor: a 3:2 Lissajous test signal draws a closed figure centred within 2% of the frame", async () => {
|
|
113
|
+
const { kept, W, H } = await render({ template: "xy-phosphor", preset: "hud-black", params: BARE }, { frames: [40, 100, 170] });
|
|
114
|
+
for (const f of [40, 100, 170]) {
|
|
115
|
+
const b = bbox(kept.get(f), W, H);
|
|
116
|
+
assert.ok(b.n > 200, `frame ${f}: figure missing (${b.n} bright px)`);
|
|
117
|
+
assert.ok(Math.abs(b.cx - W / 2) <= 0.02 * W, `frame ${f}: x centre ${b.cx} vs ${W / 2}`);
|
|
118
|
+
assert.ok(Math.abs(b.cy - H / 2) <= 0.02 * H, `frame ${f}: y centre ${b.cy} vs ${H / 2}`);
|
|
119
|
+
assert.ok(b.h > 0.6 * H && b.w > 0.6 * H, `frame ${f}: figure too small ${b.w}x${b.h}`);
|
|
120
|
+
assert.ok(enclosedArea(kept.get(f), W, H) > 100, `frame ${f}: the figure is not closed (no enclosed region)`);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
function crossings(img, W, H) {
|
|
125
|
+
const c = [];
|
|
126
|
+
for (let x = 0; x < W; x++) {
|
|
127
|
+
let sw = 0, sy = 0;
|
|
128
|
+
for (let y = 0; y < H; y++) { const g = px(img, W, x, y)[1]; if (g > 60) { sw += g; sy += g * (H - 1 - y + 0.5); } }
|
|
129
|
+
c.push(sw > 0 ? sy / sw : null);
|
|
130
|
+
}
|
|
131
|
+
const out = [];
|
|
132
|
+
for (let x = 0; x + 1 < W; x++) {
|
|
133
|
+
if (c[x] === null || c[x + 1] === null) continue;
|
|
134
|
+
const a = c[x] - H / 2, b = c[x + 1] - H / 2;
|
|
135
|
+
if (a < 0 && b >= 0) out.push({ x: x + 0.5 + -a / (b - a), dir: 1 });
|
|
136
|
+
if (a >= 0 && b < 0) out.push({ x: x + 0.5 + a / (a - b), dir: -1 });
|
|
137
|
+
}
|
|
138
|
+
return out;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
test("scope-triggered: with sync the zero crossing of a 100 Hz sine sits at the same x in frames 10 and 50 (+-2 px); free run does not", async () => {
|
|
142
|
+
const audio = wav("sine100.wav", sine(100));
|
|
143
|
+
const common = { template: "scope-triggered", params: { ...BARE_TRACE, window: 400, stereoSeparation: 0, bloom: 0, speedDim: 0, pinch: 0, thickness: 3, audioKick: 0 } };
|
|
144
|
+
const locked = await render({ ...common, params: { ...common.params, syncMode: 1 } }, { audio, frames: [10, 50] });
|
|
145
|
+
const falling = (r, f) => crossings(r.kept.get(f), r.W, r.H).find((c) => c.dir === -1);
|
|
146
|
+
const a = falling(locked, 10);
|
|
147
|
+
const b = falling(locked, 50);
|
|
148
|
+
assert.ok(a && b, "no falling zero crossing found");
|
|
149
|
+
assert.ok(Math.abs(a.x - b.x) <= 2, `synced crossing moved: ${a.x.toFixed(2)} vs ${b.x.toFixed(2)}`);
|
|
150
|
+
const free = await render({ ...common, params: { ...common.params, syncMode: 0 } }, { audio, frames: [10, 50] });
|
|
151
|
+
const first = (r, f) => crossings(r.kept.get(f), r.W, r.H).find((c) => c.x > 0.215 * r.W + 3);
|
|
152
|
+
const fa = first(free, 10);
|
|
153
|
+
const fb = first(free, 50);
|
|
154
|
+
assert.ok(Math.abs(fa.x - fb.x) > 2, `free run should jitter, crossings ${fa.x.toFixed(2)} vs ${fb.x.toFixed(2)}`);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test("scope-triggered: interpolate raw steps differ from band-limited, and stereoSeparation draws two traces", async () => {
|
|
158
|
+
const audio = wav("sine1k.wav", sine(1000));
|
|
159
|
+
const base = { template: "scope-triggered", params: { ...BARE_TRACE, window: 64, syncMode: 1, speedDim: 0, bloom: 0 } };
|
|
160
|
+
const raw = await render({ ...base, params: { ...base.params, interpolate: 0, stereoSeparation: 0 } }, { audio, frames: [60] });
|
|
161
|
+
const smooth = await render({ ...base, params: { ...base.params, interpolate: 2, stereoSeparation: 0 } }, { audio, frames: [60] });
|
|
162
|
+
let diff = 0;
|
|
163
|
+
for (let i = 0; i < raw.kept.get(60).length; i++) diff += Math.abs(raw.kept.get(60)[i] - smooth.kept.get(60)[i]);
|
|
164
|
+
assert.ok(diff > 20000, `raw and band-limited look the same (sum diff ${diff})`);
|
|
165
|
+
const two = await render({ ...base, params: { ...base.params, interpolate: 2, stereoSeparation: 0.3 } }, { audio, frames: [60] });
|
|
166
|
+
const rows = new Set();
|
|
167
|
+
const img = two.kept.get(60);
|
|
168
|
+
for (let y = 0; y < two.H; y++) for (let x = 0; x < two.W; x++) if (peak(px(img, two.W, x, y)) > 120) rows.add(Math.round((y / two.H) * 20));
|
|
169
|
+
const band = [...rows].filter((r) => r < 8).length > 0 && [...rows].filter((r) => r > 12).length > 0;
|
|
170
|
+
assert.ok(band, "expected a trace above and one below the centre");
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
test("goniometer: a mono input draws a vertical line, not a blank frame; a 3:2 test signal fills the diamond", async () => {
|
|
174
|
+
const audio = wav("mono220.wav", sine(220));
|
|
175
|
+
const m = await render({ template: "goniometer", params: BARE }, { audio, frames: [60, 120] });
|
|
176
|
+
for (const f of [60, 120]) {
|
|
177
|
+
const b = bbox(m.kept.get(f), m.W, m.H);
|
|
178
|
+
assert.ok(b.n > 50, `frame ${f} is blank`);
|
|
179
|
+
assert.ok(b.w <= 0.04 * m.W, `frame ${f}: mono should be a line, width ${b.w}`);
|
|
180
|
+
assert.ok(b.h >= 0.3 * m.H, `frame ${f}: line too short ${b.h}`);
|
|
181
|
+
assert.ok(Math.abs(b.cx - m.W / 2) <= 0.02 * m.W);
|
|
182
|
+
}
|
|
183
|
+
const s = await render({ template: "goniometer", params: { ...BARE, srcMode: 1 } }, { frames: [100] });
|
|
184
|
+
const b = bbox(s.kept.get(100), s.W, s.H);
|
|
185
|
+
assert.ok(b.w > 0.4 * s.H && b.h > 0.4 * s.H, `test signal figure too small ${b.w}x${b.h}`);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
test("spectrogram-scroll: the buffer scrolls by whole texels and a 440 Hz tone sits on the log axis", async () => {
|
|
189
|
+
const audio = wav("sine440.wav", sine(440));
|
|
190
|
+
const params = { hud: 0, grid: 0, playhead: 0, onsetTicks: 0, smoothing: 0, cell: 1, scrollPx: 8, dbMin: -70, dbMax: -30, tilt: 0 };
|
|
191
|
+
const { kept, W, H } = await render({ template: "spectrogram-scroll", params }, { audio, frames: [100, 101] });
|
|
192
|
+
const shift = Math.round((8 * W) / 1920);
|
|
193
|
+
const mx = Math.floor(0.21 * W);
|
|
194
|
+
const my = Math.floor(0.12 * H);
|
|
195
|
+
let total = 0, same = 0;
|
|
196
|
+
for (let y = my; y < H - my; y++) for (let x = mx + 2; x < W - mx - shift - 2; x++) {
|
|
197
|
+
const a = px(kept.get(101), W, x, y);
|
|
198
|
+
const b = px(kept.get(100), W, x + shift, y);
|
|
199
|
+
total++;
|
|
200
|
+
if (Math.abs(a[0] - b[0]) <= 3 && Math.abs(a[1] - b[1]) <= 3 && Math.abs(a[2] - b[2]) <= 3) same++;
|
|
201
|
+
}
|
|
202
|
+
assert.ok(same / total > 0.99, `only ${(same / total * 100).toFixed(1)}% of pixels moved by ${shift} px`);
|
|
203
|
+
let best = -1, bestRow = 0;
|
|
204
|
+
for (let y = my; y < H - my; y++) {
|
|
205
|
+
let s = 0;
|
|
206
|
+
for (let x = W - mx - 6; x < W - mx - 1; x++) s += px(kept.get(100), W, x, y).reduce((p, q) => p + q, 0);
|
|
207
|
+
if (s > best) { best = s; bestRow = y; }
|
|
208
|
+
}
|
|
209
|
+
const areaH = H - 2 * my;
|
|
210
|
+
const expected = 0.12 * H + (Math.log(440 / 50) / Math.log(16000 / 50)) * areaH;
|
|
211
|
+
assert.ok(Math.abs((H - 1 - bestRow) - expected) <= 0.05 * areaH, `tone at row ${H - 1 - bestRow}, log axis expects ${expected.toFixed(1)}`);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
function radiusAt(img, W, H, deg) {
|
|
215
|
+
const a = (deg * Math.PI) / 180;
|
|
216
|
+
let best = -1, r = 0;
|
|
217
|
+
for (let k = 0.1 * H; k < 0.49 * H; k += 0.5) {
|
|
218
|
+
const x = Math.floor(W / 2 + k * Math.cos(a)), y = Math.floor(H / 2 - k * Math.sin(a));
|
|
219
|
+
const v = peak(px(img, W, x, y));
|
|
220
|
+
if (v > best) { best = v; r = k; }
|
|
221
|
+
}
|
|
222
|
+
return r;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
test("scope-polar: silence draws a circle of ringRadius; a period-locked raw wrap is seamless, a mismatched window is not", async () => {
|
|
226
|
+
const flat = await render({ template: "scope-polar", params: { ...BARE_TRACE, stereoSeparation: 0, spin: 0 } }, { frames: [30] });
|
|
227
|
+
const img = flat.kept.get(30);
|
|
228
|
+
const radii = [];
|
|
229
|
+
for (let y = 0; y < flat.H; y++) for (let x = 0; x < flat.W; x++) if (peak(px(img, flat.W, x, y)) >= 128) radii.push(Math.hypot(x + 0.5 - flat.W / 2, flat.H / 2 - y - 0.5));
|
|
230
|
+
assert.ok(radii.length > 200, "no ring");
|
|
231
|
+
const mean = radii.reduce((p, q) => p + q, 0) / radii.length;
|
|
232
|
+
const ringRadius = lib.get("scope-polar").fx.INPUTS.find((i) => i.NAME === "ringRadius").DEFAULT;
|
|
233
|
+
assert.ok(Math.abs(mean - ringRadius * flat.H) <= 0.02 * flat.H, `ring radius ${mean.toFixed(1)} vs ${ringRadius * flat.H}`);
|
|
234
|
+
const audio = wav("sine100b.wav", sine(100));
|
|
235
|
+
const p = { ...BARE_TRACE, stereoSeparation: 0, spin: 0, loops: 1, wrap: 1, pinch: 0, interpolate: 2, amplitude: 2.4 };
|
|
236
|
+
const seam = async (extra) => {
|
|
237
|
+
const r = await render({ template: "scope-polar", params: { ...p, ...extra } }, { audio, frames: [40] });
|
|
238
|
+
const i = r.kept.get(40);
|
|
239
|
+
return Math.abs(radiusAt(i, r.W, r.H, 1.5) - radiusAt(i, r.W, r.H, -1.5)) / r.H;
|
|
240
|
+
};
|
|
241
|
+
const locked = await seam({ syncMode: 3, syncHz: 100, syncCycles: 1 });
|
|
242
|
+
const broken = await seam({ syncMode: 1, window: 400 });
|
|
243
|
+
assert.ok(locked <= 0.015, `period-locked seam jump ${(locked * 100).toFixed(2)}% of H`);
|
|
244
|
+
assert.ok(broken > 0.03, `mismatched window should show a seam, jump ${(broken * 100).toFixed(2)}% of H`);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
for (const [id, demo] of [["scope-triggered", "hud-black"], ["xy-phosphor", "hud-black"], ["goniometer", "boot-green"], ["spectrogram-scroll", "hud-black"], ["scope-polar", "hud-black"]]) {
|
|
248
|
+
test(`${id}/${demo}: renders 240 frames at 60 fps, passes determinism, records a flash audit`, async () => {
|
|
249
|
+
const t = lib.get(id);
|
|
250
|
+
const v = validateScore({ ...JSON.parse(readFileSync(path.join(t.dir, `demo-${demo}.json`), "utf8")), credit: { overlay: false } }, lib);
|
|
251
|
+
assert.equal(v.ok, true, JSON.stringify(v.errors));
|
|
252
|
+
const gate = await runJob(v.value, lib, { outDir: mkdtempSync(path.join(tmp, "j-")), width: 320, height: 180, replay: true, cwd: ROOT });
|
|
253
|
+
assert.equal(gate.render.frames, 240);
|
|
254
|
+
assert.equal(gate.render.fps, 60);
|
|
255
|
+
assert.equal(gate.determinism.pass, true, JSON.stringify(gate.determinism));
|
|
256
|
+
assert.equal(typeof gate.flash.flashesPerSecondMax, "number");
|
|
257
|
+
assert.equal(typeof gate.flash.exceeds, "boolean");
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
test("fieldMode paints one full field colour per shot (lime, ultramarine, orange, near-black) in every template", async () => {
|
|
262
|
+
const want = { 0: [11, 11, 12], 1: [200, 255, 0], 2: [20, 20, 255], 4: [255, 60, 0] };
|
|
263
|
+
for (const id of IDS) {
|
|
264
|
+
for (const [mode, rgb] of Object.entries(want)) {
|
|
265
|
+
const r = await render({ template: id, params: { fieldMode: Number(mode), hud: 0 } }, { W: 320, H: 180, frames: [2] });
|
|
266
|
+
const c = px(r.kept.get(2), 320, 3, 3);
|
|
267
|
+
c.forEach((v, i) => assert.ok(Math.abs(v - rgb[i]) <= 8, `${id} fieldMode ${mode}: corner ${c} vs ${rgb}`));
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
test("the HUD chrome and the engine text layer draw: panel frame, title text, tick rulers and readout digits", async () => {
|
|
273
|
+
const { kept, W, H } = await render({ template: "xy-phosphor", preset: "hud-black" }, { frames: [20] });
|
|
274
|
+
const img = kept.get(20);
|
|
275
|
+
const ink = (x0, y0, x1, y1, thr = 140) => { let n = 0; for (let y = Math.floor(y0 * H); y < y1 * H; y++) for (let x = Math.floor(x0 * W); x < x1 * W; x++) if (peak(px(img, W, x, y)) >= thr) n++; return n; };
|
|
276
|
+
assert.ok(ink(0.88, 0.02, 0.98, 0.14) > 25, "title text missing top right");
|
|
277
|
+
assert.ok(ink(0.02, 0.03, 0.17, 0.16) > 40, "tab label text missing top left");
|
|
278
|
+
assert.ok(ink(0.284, 0.4, 0.2885, 0.6) > 30, "central panel frame missing");
|
|
279
|
+
assert.ok(ink(0.857, 0.55, 0.975, 0.8) > 30, "readout digits and labels missing");
|
|
280
|
+
assert.ok(ink(0.05, 0.4, 0.15, 0.7) > 3, "cloud panel has no dots");
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
test("spectrogram-scroll pre-rolls the buffer: frame 0 already shows data in the panel, and preroll 0 shows none", async () => {
|
|
284
|
+
const fill = async (preroll) => {
|
|
285
|
+
const { kept, W, H } = await render({ template: "spectrogram-scroll", params: { hud: 0, preroll } }, { W: 640, H: 360, frames: [0] });
|
|
286
|
+
let n = 0, total = 0;
|
|
287
|
+
for (let y = Math.floor(0.14 * H); y < 0.86 * H; y++) for (let x = Math.floor(0.22 * W); x < 0.5 * W; x++) { total++; if (peak(px(kept.get(0), W, x, y)) > 60) n++; }
|
|
288
|
+
return n / total;
|
|
289
|
+
};
|
|
290
|
+
const on = await fill(1);
|
|
291
|
+
const off = await fill(0);
|
|
292
|
+
assert.ok(on > 0.03, `pre-roll left the left half of the panel nearly empty (${(on * 100).toFixed(1)}%)`);
|
|
293
|
+
assert.ok(off < 0.005, `preroll 0 should start empty (${(off * 100).toFixed(1)}%)`);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
for (const [id, demoName] of [["scope-polar", "field-lime"], ["scope-triggered", "field-ultramarine"]]) {
|
|
297
|
+
test(`${id}: the declared safeSubstitute keeps the ${demoName} demo within the flash limits`, async () => {
|
|
298
|
+
const t = lib.get(id);
|
|
299
|
+
const demo = JSON.parse(readFileSync(path.join(t.dir, `demo-${demoName}.json`), "utf8"));
|
|
300
|
+
const v = validateScore({ ...demo, params: t.fx.X_AGENTVFX.safeSubstitute.params, credit: { overlay: false } }, lib);
|
|
301
|
+
assert.equal(v.ok, true, JSON.stringify(v.errors));
|
|
302
|
+
const gate = await runJob(v.value, lib, { outDir: mkdtempSync(path.join(tmp, "s-")), width: 320, height: 180, replay: false, cwd: ROOT });
|
|
303
|
+
assert.equal(gate.flash.exceeds, false, JSON.stringify(gate.flash.worstWindow));
|
|
304
|
+
assert.equal(gate.flash.redFlashes, 0);
|
|
305
|
+
});
|
|
306
|
+
}
|