INNER CODE UNIT · JavaScript
fadeWindow
mario-andreschak/FLUJO · githubpages/short/app.js:298
function fadeWindow(local, start, end, fade = .45) {
if (local < start || local > end) return 0;
return Math.min(smoothstep(invLerp(start, start + fade, local)), 1 - smoothstep(invLerp(end - fade, end, local)));
}
function renderChaos(local) {
const hook = $("#hook-line");
const kicker = $("#hook-kicker");
const hookBeats = [
{ start: .3, end: 2.5, kicker: "USING", text: "Claude Code?" },
{ start: 2.5, end: 3.75, kicker: "OR", text: "Codex?" },
{ start: 3.75, end: 5, kicker: "OR", text: "Cline?" },
{ start: 5, end: 6.2, kicker: "OR", text: "Ollama?" },
];
const activeHook = hookBeats.find(beat => local >= beat.start && local < beat.end);
if (activeHook) {
const opacity = fadeWindow(local, activeHook.start, activeHook.end, .26);
hook.textContent = activeHook.text;