INNER CODE UNIT · JavaScript
sceneOpacity
mario-andreschak/FLUJO · githubpages/short/app.js:264
function sceneOpacity(t, start, end, fadeIn = 1.15, fadeOut = 1.15) {
if (t < start || t > end) return 0;
const enter = smoothstep(invLerp(start, start + fadeIn, t));
const leave = 1 - smoothstep(invLerp(end - fadeOut, end, t));
return Math.min(enter, leave);
}
function activateScene(scene, t) {
const el = sceneEls.get(scene.id);
const opacity = sceneOpacity(t, scene.start, scene.end);
el.style.opacity = opacity.toFixed(4);
el.style.visibility = opacity > .001 ? "visible" : "hidden";
return { el, local: t - scene.start, opacity };
}
function reveal(el, local, at, duration = .8, options = {}) {
const {
x = 0,