Let scenes layer on each other, and give the camera somewhere to look

Two devices that were built, wired up, and doing nothing.

OVERLAYS. buildStack gated layering on `surfaceOf(m) === 'composable'`, and
no scene in the library declared `surface` — so the only thing that could ever
sit on top was the one scene declaring `role: 'accent'`, and the overlay roster
excluded accents by construction. Empty intersection, every time: 0/144 stacks
carried an overlay. Every layered frame in every song was the same particle
field.

Labelled the library from the phase 12 coverage gate rather than by eye: the
37 scenes painting under 30% of the frame are composable. Particle Field loses
its privileged slot and becomes one of them, keeping only `background: false`,
which is the honest part — points in empty space cannot carry a section alone.
The reserved accent slot is gone; one roster, two passes at it. 1 distinct
overlay scene becomes 27, and the rate lands at 34% of stacks after trimming a
base chance that had been tuned while the branch was dead.

THE CAMERA. framing.shift moved the frame by a median of 0.029 of a half-frame
at a fresh random angle every shot, so successive offsets cancelled and the
median jump at a cut was 0.014. Present in every frame, visible in none.

look/Camera.js is the director's camera department: the story says tension,
order and which act a section is in, and this turns that into where the frame
looks and how it travels there. Each director names a camera. Jump distance
follows tension and act, speed follows energy, and the curve is one of four.
Cuts choose between reframing and matching, so two scenes can still read as one
place. Median offset 0.190, median reframe 0.135, and 94% of shots now move
during the shot rather than only at the cut.

Four new gates, each with a FLOOR — the device this replaces passed every
existing check while doing nothing, because the only bound was a ceiling.

Also lands the in-progress Epic 4 story layer it builds on: Story.js, phase 13,
and the direction statistic.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Dejvino
2026-08-19 06:48:13 +02:00
co-authored by Claude Opus 5
parent eda8ac3810
commit 1ca9fa2f1f
69 changed files with 2686 additions and 149 deletions
+30 -1
View File
@@ -14,7 +14,8 @@ export const SECTION_KINDS = ['intro', 'build', 'drop', 'sustain', 'breakdown',
const ANALYSIS_HZ = 4; // coarse grid for the similarity matrix
const KERNEL_SECONDS = 6; // half-width of the checkerboard kernel
const MIN_SECTION_SECONDS = 12;
const MIN_SECTION_SECONDS = 4;
const DROP_HEAD_BARS = 16; // how long a drop stays a drop before it is just the track
function median(values) {
if (!values.length) return 0;
@@ -170,6 +171,31 @@ function classify(section, context) {
return 'sustain';
}
/**
* A drop is an EVENT — the arrival — and what follows is the track's main body,
* however loud that stays. classify() has no memory of what came before, so a
* long loud stretch labels every one of its sections 'drop' and the video holds
* peak intensity for minutes on end.
*
* Collapse each run of drops down to its head: the opening sections keep the
* label until a phrase's worth of time is spent, and the rest become 'sustain'.
* Runs are read off the ORIGINAL labels so the demotion never cascades, and any
* other kind in between — a breakdown, a build — re-arms the next drop.
*/
function collapseDropRuns(sections, secondsPerBar) {
const budget = DROP_HEAD_BARS * secondsPerBar;
const original = sections.map((s) => s.kind);
let spent = 0;
for (let i = 0; i < sections.length; i++) {
if (original[i] !== 'drop') { spent = 0; continue; }
const continues = i > 0 && original[i - 1] === 'drop';
if (!continues) spent = 0;
else if (spent >= budget) sections[i].kind = 'sustain';
spent += sections[i].duration;
}
}
/**
* @returns {Array<{index,start,end,startFrame,endFrame,kind,energy,slope,flux,centroid}>}
*/
@@ -262,5 +288,8 @@ export function segment(raw, frameCount, fps, tempo) {
);
});
const bpm = Number.isFinite(tempo.bpm) && tempo.bpm > 1 ? tempo.bpm : 120;
collapseDropRuns(sections, (4 * 60) / bpm);
return sections;
}