Update color scheme from warm earth tones to cool blue-white palette and optimize rendering performance

Change substrate colors to darker grain and pure white mycelium/fruits. Replace warm gradients with cool blue-white tones throughout (body, LED strips, humidifier elements). Add subtle background patterns for colonization and fruiting compartments. Switch empty slot indicators and hardware accents to light blue.

Optimize rendering by precomputing static bag geometry, implementing seeded RNG for determin
This commit is contained in:
grove5_admin committed 2026-04-27 18:39:38 -07:00
1 parent 6d9c41b640
commit a3a5b8ca38
4 files changed
+240 -171

No files matched your search

+235 -163
View File
@@ -74,6 +74,14 @@
};
}
// ── Precomputed static geometry ───────────────────────────────
// LEFT/RIGHT never change so we compute rects + shelf lines once
// at module scope instead of inside every {#each} render pass.
const BAG_RECTS_LEFT: Rect[][] = [0, 1, 2].map(r => [0, 1].map(c => bagRect(LEFT, r, c)));
const BAG_RECTS_RIGHT: Rect[][] = [0, 1, 2].map(r => [0, 1].map(c => bagRect(RIGHT, r, c)));
const SHELF_YS_LEFT = shelfYs(LEFT).slice(1);
const SHELF_YS_RIGHT = shelfYs(RIGHT).slice(1);
function contamColor(bag: BagState): string | null {
if (bag.vision.contamination_risk === 'high') return '#d55a5a';
if (bag.vision.contamination_risk === 'low') return '#d99050';
@@ -118,28 +126,97 @@
// Low atmospheric fog bands — horizontal wisps that drift, not rise.
// This reads more like ambient humidity than individual particles.
const FOG_BANDS = [
{ yFrac: 0.88, rx: 70, ry: 10, opacity: 0.78, dur: 9, delay: 0 },
{ yFrac: 0.80, rx: 64, ry: 8, opacity: 0.55, dur: 11, delay: 2 },
{ yFrac: 0.70, rx: 56, ry: 6, opacity: 0.35, dur: 13, delay: 4 },
{ yFrac: 0.60, rx: 48, ry: 5, opacity: 0.22, dur: 15, delay: 6 },
{ yFrac: 0.97, rx: 70, ry: 10, opacity: 0.8, dur: 20, delay: 0 },
{ yFrac: 0.93, rx: 70, ry: 10, opacity: 0.55, dur: 30, delay: 2 },
{ yFrac: 0.88, rx: 56, ry: 10, opacity: 0.35, dur: 13, delay: 4 },
{ yFrac: 0.85, rx: 48, ry: 10, opacity: 0.22, dur: 15, delay: 6 },
];
// A couple of gentle vertical wisps rising straight from the vent
const FOG_WISPS = [
{ xFrac: 0.38, dur: 8.5, delay: 0.0, sway: 4 },
{ xFrac: 0.62, dur: 9.2, delay: 2.4, sway: -3 },
];
// Humidity readout (live) — shown inside the fruiting compartment
// so users instantly associate the fog with humidity.
const fruitRh = $derived(fruiting.environment?.rh_pct ?? 0);
// Reservoir water level. The bottle's usable interior runs from y=4.4
// to y=20.9 in local coords (height 16.5). Water surface sits at
// y=20.9 when empty and rises toward y=4.4 when full.
const resPct = $derived(hw.humidifier.reservoir_pct);
const resLow = $derived(resPct < 15);
const waterY = $derived(20.9 - (resPct / 100) * 16.5);
// How far a bubble travels from its starting cy=20 up to waterY+0.8.
// CSS animations only support transform, so we expose this as a px delta.
const bubbleRise = $derived(waterY + 0.8 - 20);
// ── Seeded RNG + fruit layout cache ───────────────────────────
// Computing fruit positions with Math.random() on every render is a
// huge waste: the layout re-shuffles on every store tick. Here we
// derive a deterministic layout per bag from its slot_id and cache
// it until the bag's stage (or count) changes.
type FruitShape = {
cx: number; cy: number; rx: number; ry: number;
opacity: number;
lines: { x1: number; y1: number; x2: number; y2: number }[];
lineWidth: number; lineOpacity: number;
};
function hashSeed(id: string): number {
let h = 2166136261;
for (let i = 0; i < id.length; i++) h = Math.imul(h ^ id.charCodeAt(i), 16777619);
return (h >>> 0) || 1;
}
function makeRng(seed: number): () => number {
let s = seed;
return () => {
s = (s * 9301 + 49297) % 233280;
return s / 233280;
};
}
const GILL_LINES = 8; // was 20; visually indistinguishable, 2.5× fewer nodes
function computeFruits(bag: BagState, br: Rect): FruitShape[] {
if (bag.vision.colonization_pct < 100) return [];
const stage = bag.vision.stage;
if (stage !== 'fruiting' && stage !== 'harvest') return [];
const fruitCount = stage === 'fruiting' ? 5 : 12;
const fruitScale = stage === 'fruiting' ? 0.9 : 2.5;
const rng = makeRng(hashSeed(bag.slot_id));
const out: FruitShape[] = [];
for (let i = 0; i < fruitCount; i++) {
const baseX = 0.1 + rng() * 0.8;
const baseY = 0.02 + rng() * 0.3;
const size = (3 + rng() * 6) * fruitScale;
const rx = size * (0.8 + rng() * 0.4);
const ry = size * 0.5 * (0.8 + rng() * 0.4);
const cx = br.w * baseX;
const cy = br.h * baseY;
const opacity = 0.85 + rng() * 0.15;
const baseAngle = rng() * Math.PI;
const lineStart = 0.1 + rng() * 0.15;
const lineWidth = 0.15 + rng() * 0.25;
const lineOpacity = 0.3 + rng() * 0.3;
const lines: FruitShape['lines'] = [];
for (let j = 0; j < GILL_LINES; j++) {
const a = (j / GILL_LINES) * Math.PI * 2 + baseAngle;
lines.push({
x1: cx + Math.cos(a) * rx * lineStart,
y1: cy + Math.sin(a) * ry * lineStart,
x2: cx + Math.cos(a) * rx * 0.9,
y2: cy + Math.sin(a) * ry * 0.9,
});
}
out.push({ cx, cy, rx, ry, opacity, lines, lineWidth, lineOpacity });
}
return out;
}
// Keyed by slot_id so layouts stay stable across store ticks that
// don't alter the fruiting grid.
const fruitLayouts = $derived.by(() => {
const map = new Map<string, FruitShape[]>();
for (let r = 0; r < 3; r++) {
for (let c = 0; c < 2; c++) {
const bag = fruitGrid[r]?.[c];
if (!bag) continue;
map.set(bag.slot_id, computeFruits(bag, BAG_RECTS_RIGHT[r][c]));
}
}
return map;
});
</script>
<div class="twin-wrap">
@@ -150,10 +227,10 @@
aria-label="Your Cultivar — {occupiedCol + occupiedFruit} of {totalCol + totalFruit} bags growing"
>
<defs>
<linearGradient id="body-grad" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#fbf7ec"/>
<stop offset="55%" stop-color="#f4efe3"/>
<stop offset="100%" stop-color="#e6ddc8"/>
<linearGradient id="body-grad" x1="0" y1="0" x2="1" y2="0.3">
<stop offset="0%" stop-color="#cac9d1"/>
<stop offset="65%" stop-color="#fff"/>
<stop offset="100%" stop-color="#f0f4f7"/>
</linearGradient>
<linearGradient id="col-inner" x1="0.5" y1="0" x2="0.5" y2="1">
@@ -161,11 +238,19 @@
<stop offset="100%" stop-color="#161a12"/>
</linearGradient>
<pattern id="col-pattern" patternUnits="userSpaceOnUse" width="250" height="500">
<image href="/img/illustration_mycelium.webp" x="-10" y="45" width="250" height="500" opacity="0.25"/>
</pattern>
<linearGradient id="fruit-inner" x1="0.5" y1="0" x2="0.5" y2="1">
<stop offset="0%" stop-color="#f0e8d2"/>
<stop offset="100%" stop-color="#e1d6b9"/>
<stop offset="0%" stop-color="#fff"/>
<stop offset="100%" stop-color="#fff"/>
</linearGradient>
<pattern id="fruit-pattern" patternUnits="userSpaceOnUse" width="500" height="550">
<image href="/img/illustration_oysters.webp" x="0" y="-20" width="500" height="550" opacity="0.07"/>
</pattern>
<linearGradient id="glass-shine" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#ffffff" stop-opacity="0.16"/>
<stop offset="22%" stop-color="#ffffff" stop-opacity="0.04"/>
@@ -222,8 +307,10 @@
<feGaussianBlur in="SourceGraphic" stdDeviation="2.4"/>
</filter>
<!-- Soft drop shadow under a bag — like it's resting on the shelf -->
<filter id="bag-shadow" x="-20%" y="-20%" width="140%" height="140%">
<!-- Soft drop shadow under a bag — like it's resting on the shelf.
Filter region kept tight so the browser allocates a smaller
offscreen buffer per bag. -->
<filter id="bag-shadow" x="-5%" y="-5%" width="110%" height="115%">
<feGaussianBlur in="SourceAlpha" stdDeviation="0.7"/>
<feOffset dx="0" dy="1.2"/>
<feComponentTransfer><feFuncA type="linear" slope="0.35"/></feComponentTransfer>
@@ -252,31 +339,31 @@
</linearGradient>
<!-- Warm bloom at the top of the fruiting compartment when the grow light is on -->
<radialGradient id="grow-bloom" cx="50%" cy="0%" r="80%" fy="0%">
<stop offset="0%" stop-color="#ffe9b6" stop-opacity="0.65"/>
<stop offset="40%" stop-color="#ffd890" stop-opacity="0.22"/>
<stop offset="100%" stop-color="#ffd890" stop-opacity="0"/>
<radialGradient id="grow-bloom" cx="50%" cy="0%" r="80%">
<stop offset="0%" stop-color="#e8f4fc" stop-opacity="1"/>
<stop offset="30%" stop-color="#d4e9f7" stop-opacity="0.5"/>
<stop offset="100%" stop-color="#d4e9f7" stop-opacity="0"/>
</radialGradient>
<!-- Ultrasonic mist bloom -->
<radialGradient id="mist-bloom" cx="50%" cy="50%" r="60%">
<stop offset="0%" stop-color="#c0e4d3" stop-opacity="0.55"/>
<stop offset="60%" stop-color="#c0e4d3" stop-opacity="0.12"/>
<stop offset="100%" stop-color="#c0e4d3" stop-opacity="0"/>
<stop offset="0%" stop-color="#8edffa" stop-opacity="0.95"/>
<stop offset="60%" stop-color="#8edffa" stop-opacity="0.12"/>
<stop offset="100%" stop-color="#8edffa" stop-opacity="0"/>
</radialGradient>
<!-- Soft blur for mist particles. Keep stdDeviation modest so the
puff doesn't dilute below visibility. -->
<filter id="mist-soften" x="-50%" y="-50%" width="200%" height="200%">
<feGaussianBlur in="SourceGraphic" stdDeviation="0.8"/>
<feGaussianBlur in="SourceGraphic" stdDeviation="1.5"/>
</filter>
<!-- Radial fade for a single mist puff. Denser centre + a strong
cream tone so it reads against the warm interior. -->
<radialGradient id="mist-puff" cx="50%" cy="50%" r="60%">
<stop offset="0%" stop-color="#ffffff" stop-opacity="1"/>
<stop offset="50%" stop-color="#f4efe0" stop-opacity="0.75"/>
<stop offset="100%" stop-color="#f4efe0" stop-opacity="0"/>
<radialGradient id="mist-puff" cx="50%" cy="70%" r="70%">
<stop offset="0%" stop-color="#8edffa" stop-opacity="0.6"/>
<stop offset="40%" stop-color="#8edffa" stop-opacity="0.4"/>
<stop offset="100%" stop-color="#8edffa" stop-opacity="0"/>
</radialGradient>
<!-- Clip the mist so it never spills outside the fruiting interior -->
@@ -335,6 +422,9 @@
<rect x={LEFT.x} y={LEFT.y}
width={LEFT.w} height={LEFT.h} rx="4"
fill="url(#col-inner)" stroke="#2e2a20" stroke-width="0.6"/>
<rect x={LEFT.x} y={LEFT.y}
width={LEFT.w} height={LEFT.h} rx="4"
fill="url(#col-pattern)" pointer-events="none"/>
<!-- LED strip (only visible when colonization work light is on) -->
<line x1={LEFT.x + 4} y1={LEFT.y + 3} x2={LEFT.x + LEFT.w - 4} y2={LEFT.y + 3}
@@ -346,14 +436,14 @@
<rect x={LEFT.x} y={LEFT.y} width={LEFT.w} height={LEFT.h} rx="4"
fill="url(#col-led)" pointer-events="none"/>
{#each shelfYs(LEFT).slice(1) as sy}
{#each SHELF_YS_LEFT as sy}
<line x1={LEFT.x + 2} y1={sy} x2={LEFT.x + LEFT.w - 2} y2={sy}
stroke="#2d2f25" stroke-width="0.8" opacity="0.9"/>
{/each}
{#each colGrid as row, ri}
{#each row as bag, ci}
{@const br = bagRect(LEFT, ri, ci)}
{#each colGrid as row, ri (ri)}
{#each row as bag, ci (ci)}
{@const br = BAG_RECTS_LEFT[ri][ci]}
{#if bag}
{@const cc = contamColor(bag)}
{@const fh = Math.max(4, (br.h - 4) * bag.vision.colonization_pct / 100)}
@@ -372,7 +462,7 @@
fill="var(--bag-grain)" fill-opacity="0.78"/>
<rect x={br.x + 1.5} y={br.y + 1.5 + (br.h - 3 - fh)}
width={br.w - 3} height={fh} rx="2.5"
fill="var(--bag-mycelium)" fill-opacity="0.9"/>
fill="var(--bag-mycelium)" fill-opacity="1"/>
</g>
<g filter="url(#label-shadow)" pointer-events="none">
@@ -438,12 +528,15 @@
<rect x={RIGHT.x} y={RIGHT.y}
width={RIGHT.w} height={RIGHT.h} rx="4"
fill="url(#fruit-inner)" stroke="#beb395" stroke-width="0.6"/>
<rect x={RIGHT.x} y={RIGHT.y}
width={RIGHT.w} height={RIGHT.h} rx="4"
fill="url(#fruit-pattern)" pointer-events="none"/>
<!-- Top LED strip -->
<line x1={RIGHT.x + 4} y1={RIGHT.y + 3} x2={RIGHT.x + RIGHT.w - 4} y2={RIGHT.y + 3}
stroke={fruitGrowLight?.on ? '#f2e8c6' : '#cfd9c0'}
stroke-width={fruitGrowLight?.on ? 1.6 : 0.9}
stroke-opacity={fruitGrowLight?.on ? 0.95 : 0.5}
stroke={fruitGrowLight?.on ? '#5bd4fc' : '#cfd9c0'}
stroke-width={fruitGrowLight?.on ? 1.2 : 0.9}
stroke-opacity={fruitGrowLight?.on ? 1 : 0.5}
stroke-linecap="round"/>
<rect x={RIGHT.x} y={RIGHT.y} width={RIGHT.w} height={RIGHT.h} rx="4"
@@ -451,23 +544,23 @@
<!-- Warm bloom emanating from the top LED strip when the grow light is on -->
{#if fruitGrowLight?.on}
<rect x={RIGHT.x + 2} y={RIGHT.y + 2} width={RIGHT.w - 4} height={46}
fill="url(#grow-bloom)" pointer-events="none" class="grow-bloom-anim"/>
<rect x={RIGHT.x + 2} y={RIGHT.y + 2} width={RIGHT.w - 4} height={100}
fill="url(#grow-bloom)" pointer-events="none" />
{/if}
{#each shelfYs(RIGHT).slice(1) as sy}
{#each SHELF_YS_RIGHT as sy}
<line x1={RIGHT.x + 2} y1={sy} x2={RIGHT.x + RIGHT.w - 2} y2={sy}
stroke="#b0a588" stroke-width="0.8" opacity="0.8"/>
{/each}
{#each fruitGrid as row, ri}
{#each row as bag, ci}
{@const br = bagRect(RIGHT, ri, ci)}
{#each fruitGrid as row, ri (ri)}
{#each row as bag, ci (ci)}
{@const br = BAG_RECTS_RIGHT[ri][ci]}
{#if bag}
{@const cc = contamColor(bag)}
{@const pct = bag.vision.colonization_pct}
{@const fh = Math.max(4, (br.h - 4) * pct / 100)}
{@const showFruits = pct >= 100 && (bag.vision.stage === 'fruiting' || bag.vision.stage === 'harvest')}
{@const fruits = fruitLayouts.get(bag.slot_id) ?? []}
<g
role="button"
tabindex="0"
@@ -477,19 +570,29 @@
onkeydown={(e) => (e.key === 'Enter' || e.key === ' ') && handleBagTap(bag, e)}
>
<g filter="url(#bag-shadow)">
<rect x={br.x} y={br.y} width={br.w} height={br.h} rx="3"
fill="#c4ba9b" stroke="#928766" stroke-width="0.5"/>
<rect x={br.x + 1.5} y={br.y + 1.5} width={br.w - 3} height={br.h - 3} rx="2.5"
fill="var(--bag-grain)" fill-opacity="0.55"/>
fill="var(--bag-grain)" fill-opacity="0.45"/>
<rect x={br.x + 1.5} y={br.y + 1.5 + (br.h - 3 - fh)}
width={br.w - 3} height={fh} rx="2.5"
fill="var(--bag-mycelium)" fill-opacity="0.94"/>
fill="var(--bag-mycelium)" fill-opacity="0.95"/>
{#if showFruits}
{#if fruits.length}
<g transform="translate({br.x}, {br.y})" pointer-events="none">
<ellipse cx={br.w * 0.28} cy="2" rx="5" ry="3" fill="var(--bag-fruit)" opacity="0.92"/>
<ellipse cx={br.w * 0.55} cy="0.5" rx="6.5" ry="3.5" fill="#a17853" opacity="0.95"/>
<ellipse cx={br.w * 0.78} cy="2.5" rx="4.5" ry="2.8" fill="var(--bag-fruit)" opacity="0.88"/>
{#each fruits as f, i (i)}
<ellipse
cx={f.cx} cy={f.cy} rx={f.rx} ry={f.ry}
fill="var(--bag-fruit)"
opacity={f.opacity}
/>
{#each f.lines as l, j (j)}
<line
x1={l.x1} y1={l.y1} x2={l.x2} y2={l.y2}
stroke="#aaa"
stroke-width={f.lineWidth}
opacity={f.lineOpacity}
/>
{/each}
{/each}
</g>
{/if}
</g>
@@ -523,7 +626,7 @@
</g>
{:else}
<rect x={br.x + 2} y={br.y + 2} width={br.w - 4} height={br.h - 4} rx="3"
fill="none" stroke="#a89d80" stroke-width="0.7"
fill="none" stroke="#8edffa" stroke-width="0.7"
stroke-dasharray="3 3" stroke-opacity="0.55"/>
{/if}
{/each}
@@ -559,21 +662,17 @@
<!-- ═══ BASE · humidifier + fans ═══ -->
<g class="base-hw" aria-hidden="true">
<!-- Humidifier icon (center of base) — ultrasonic disc -->
<g transform="translate(240, 377)" aria-label="Humidifier">
<g transform="translate(245, 377)" aria-label="Humidifier">
{#if humidOn}
<!-- Ambient mist bloom -->
<circle r="14" fill="url(#mist-bloom)" pointer-events="none" class="mist-bloom-anim"/>
{/if}
<circle r="6" fill={humidOn ? '#dff0ea' : '#e8e0c9'} stroke="#a89d80" stroke-width="0.6"/>
<circle r="6" fill={humidOn ? '#80aebd' : '#e8e0c9'} stroke="#8edffa" stroke-width="0.6"/>
{#if humidOn}
{#each [0, 1, 2] as i}
<circle r="6" fill="none" stroke="#7bb3a2" stroke-width="0.6" opacity="0">
<animate attributeName="r" values="6;12" dur="2.2s" begin="{i * 0.6}s" repeatCount="indefinite"/>
<animate attributeName="opacity" values="0.55;0" dur="2.2s" begin="{i * 0.6}s" repeatCount="indefinite"/>
</circle>
{#each [0, 1, 2] as i (i)}
<circle class="mist-ring" r="6" fill="none" stroke="#7bb3a2" stroke-width="0.6"
style="animation-delay: {i * 0.6}s"/>
{/each}
<path d="M-2,-1 Q-1,1 -2,2.5 M0,-1.5 Q1,0.5 0,2 M2,-1 Q3,1 2,2.5"
stroke="#2b7a6b" stroke-width="0.6" fill="none" opacity="0.65"/>
{/if}
</g>
@@ -581,7 +680,7 @@
a live water level, meniscus highlight, and rising bubbles
while the humidifier is running. Derived values (`resPct`,
`resLow`, `waterY`) live in the script block. -->
<g transform="translate(258, 367)" aria-label="Water reservoir, {resPct}% full"
<g transform="translate(258, 365)" aria-label="Water reservoir, {resPct}% full"
class:reservoir-low={resLow}>
<!-- Bottle silhouette: short neck, curved shoulders, rounded body -->
<path
@@ -617,26 +716,15 @@
<rect x="0" y={waterY + 0.5} width="14" height="0.35"
fill="#ffffff" opacity="0.22"/>
<!-- Subtle rising bubbles (only when humidifier is active) -->
<!-- Subtle rising bubbles (only when humidifier is active).
Animated via CSS transform so the compositor can accelerate. -->
{#if humidOn && !resLow}
<circle cx="4.8" cy="20" r="0.45" fill="#ffffff" opacity="0">
<animate attributeName="cy" values="20;{waterY + 0.8}"
dur="3.2s" begin="0s" repeatCount="indefinite"/>
<animate attributeName="opacity" values="0;0.85;0"
keyTimes="0;0.3;1" dur="3.2s" begin="0s" repeatCount="indefinite"/>
</circle>
<circle cx="9.1" cy="20" r="0.35" fill="#ffffff" opacity="0">
<animate attributeName="cy" values="20;{waterY + 0.8}"
dur="4.1s" begin="1.4s" repeatCount="indefinite"/>
<animate attributeName="opacity" values="0;0.75;0"
keyTimes="0;0.3;1" dur="4.1s" begin="1.4s" repeatCount="indefinite"/>
</circle>
<circle cx="7" cy="20" r="0.3" fill="#ffffff" opacity="0">
<animate attributeName="cy" values="20;{waterY + 0.8}"
dur="4.6s" begin="2.7s" repeatCount="indefinite"/>
<animate attributeName="opacity" values="0;0.7;0"
keyTimes="0;0.3;1" dur="4.6s" begin="2.7s" repeatCount="indefinite"/>
</circle>
<circle class="bubble" cx="4.8" cy="20" r="0.45" fill="#ffffff"
style="--rise: {bubbleRise}px; --dur: 3.2s; --delay: 0s; --peak: 0.85"/>
<circle class="bubble" cx="9.1" cy="20" r="0.35" fill="#ffffff"
style="--rise: {bubbleRise}px; --dur: 4.1s; --delay: 1.4s; --peak: 0.75"/>
<circle class="bubble" cx="7" cy="20" r="0.3" fill="#ffffff"
style="--rise: {bubbleRise}px; --dur: 4.6s; --delay: 2.7s; --peak: 0.7"/>
{/if}
</g>
@@ -665,7 +753,7 @@
<!-- Colonization fan (bottom-left of base) -->
<g transform="translate(100, 377)" aria-label="Colonization fan">
<circle r="7" fill="#f2ebd8" stroke="#b0a588" stroke-width="0.6"/>
<circle r="7" fill="#fff" stroke="#b0a588" stroke-width="0.6"/>
<g class="fan-blades" class:spinning={colFanSpinning} style="--fan-dur: {colFanDur}">
{#each [0, 90, 180, 270] as a}
<path transform="rotate({a})"
@@ -679,7 +767,7 @@
<!-- Fruiting fan (bottom-right of base) -->
<g transform="translate(380, 377)" aria-label="Fruiting fan">
<circle r="7" fill="#f2ebd8" stroke="#b0a588" stroke-width="0.6"/>
<circle r="7" fill="#fff" stroke="#b0a588" stroke-width="0.6"/>
<g class="fan-blades" class:spinning={fruitFanSpinning} style="--fan-dur: {fruitFanDur}">
{#each [0, 90, 180, 270] as a}
<path transform="rotate({a})"
@@ -697,82 +785,17 @@
and layering low horizontal fog bands that drift sideways,
rather than individual particles that rise straight up. -->
{#if humidOn}
{@const ventW = 60}
{@const ventX = RIGHT.x + (RIGHT.w - ventW) / 2}
{@const ventY = RIGHT.y + RIGHT.h - 8}
<!-- Mist-output vent at the bottom of the fruiting compartment -->
<g pointer-events="none">
<rect x={ventX} y={ventY} width={ventW} height="3" rx="1.2"
fill="#9d9377" opacity="0.5"/>
{#each [0, 1, 2, 3, 4, 5, 6, 7] as i}
<line
x1={ventX + 4 + i * 7} y1={ventY + 0.5}
x2={ventX + 4 + i * 7} y2={ventY + 2.5}
stroke="#6b6451" stroke-width="0.5" opacity="0.6"/>
{/each}
</g>
<!-- Low fog bands — horizontal drift, not vertical rise -->
<!-- Low fog bands — horizontal drift, not vertical rise.
Animated via CSS transform on a wrapper <g> so the
compositor (not SMIL's main-thread interpolator) can drive it. -->
<g filter="url(#mist-soften)" clip-path="url(#mist-clip)" pointer-events="none">
{#each FOG_BANDS as f, i}
{#each FOG_BANDS as f, i (i)}
{@const cx = RIGHT.x + RIGHT.w / 2}
{@const cy = RIGHT.y + RIGHT.h * f.yFrac}
<ellipse
cx={cx} cy={cy}
rx={f.rx} ry={f.ry}
fill="url(#mist-puff)"
opacity={f.opacity}
>
<!-- Gentle horizontal drift, ping-pong -->
<animate attributeName="cx"
values="{cx};{cx + 14};{cx};{cx - 14};{cx}"
keyTimes="0;0.25;0.5;0.75;1"
dur="{f.dur}s" begin="{f.delay}s" repeatCount="indefinite"
calcMode="spline" keySplines="0.4 0 0.6 1; 0.4 0 0.6 1; 0.4 0 0.6 1; 0.4 0 0.6 1"/>
<!-- Subtle vertical bob so the band breathes -->
<animate attributeName="cy"
values="{cy};{cy - 2};{cy};{cy + 1};{cy}"
keyTimes="0;0.25;0.5;0.75;1"
dur="{f.dur}s" begin="{f.delay}s" repeatCount="indefinite"/>
<!-- Subtle width breath so fog "rolls" -->
<animate attributeName="rx"
values="{f.rx};{f.rx * 1.08};{f.rx};{f.rx * 0.95};{f.rx}"
keyTimes="0;0.3;0.5;0.7;1"
dur="{f.dur}s" begin="{f.delay}s" repeatCount="indefinite"/>
</ellipse>
{/each}
<!-- A couple of slow vertical wisps rising out of the vent -->
{#each FOG_WISPS as w, i}
{@const startX = RIGHT.x + RIGHT.w * w.xFrac}
{@const endX = startX + w.sway}
{@const yStart = ventY - 2}
{@const yEnd = RIGHT.y + RIGHT.h * 0.35}
<ellipse
cx={startX} cy={yStart}
rx="8" ry="5"
fill="url(#mist-puff)"
opacity="0"
>
<animate attributeName="cy"
values="{yStart};{yEnd}"
dur="{w.dur}s" begin="{w.delay}s" repeatCount="indefinite"
calcMode="spline" keySplines="0.5 0 0.7 1"/>
<animate attributeName="cx"
values="{startX};{endX}"
dur="{w.dur}s" begin="{w.delay}s" repeatCount="indefinite"/>
<animate attributeName="rx"
values="8;20"
dur="{w.dur}s" begin="{w.delay}s" repeatCount="indefinite"/>
<animate attributeName="ry"
values="5;10"
dur="{w.dur}s" begin="{w.delay}s" repeatCount="indefinite"/>
<animate attributeName="opacity"
values="0;0.55;0.3;0"
keyTimes="0;0.3;0.75;1"
dur="{w.dur}s" begin="{w.delay}s" repeatCount="indefinite"/>
</ellipse>
<g class="fog-band" style="transform-origin: {cx}px {cy}px; animation-duration: {f.dur}s; animation-delay: {f.delay}s">
<ellipse cx={cx} cy={cy} rx={f.rx} ry={f.ry}
fill="url(#mist-puff)" opacity={f.opacity}/>
</g>
{/each}
</g>
{/if}
@@ -809,6 +832,9 @@
gap: 10px;
width: 100%;
min-width: 0;
/* Skip painting the whole twin while it's scrolled offscreen */
content-visibility: auto;
contain-intrinsic-size: 680px 500px;
}
.appliance {
@@ -820,6 +846,53 @@
overflow: visible;
}
/* ── Humidifier mist rings (replacement for SMIL <animate>) ── */
.mist-ring {
transform-box: fill-box;
transform-origin: center;
opacity: 0;
will-change: transform, opacity;
animation: mist-ring-expand 2.2s ease-out infinite;
}
@keyframes mist-ring-expand {
0% { transform: scale(1); opacity: 0.55; }
100% { transform: scale(2); opacity: 0; }
}
/* ── Reservoir bubbles (CSS transform instead of SMIL) ── */
.bubble {
transform-box: fill-box;
will-change: transform, opacity;
opacity: 0;
animation: bubble-rise var(--dur, 3s) linear var(--delay, 0s) infinite;
}
@keyframes bubble-rise {
0% { transform: translateY(0); opacity: 0; }
30% { opacity: var(--peak, 0.8); }
100% { transform: translateY(var(--rise)); opacity: 0; }
}
/* ── Fog bands: drift, bob, and breathe via a compositor-friendly
transform on a wrapper <g> (was 3 SMIL <animate> each) ── */
.fog-band {
will-change: transform;
animation-name: fog-drift;
animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
animation-iteration-count: infinite;
}
@keyframes fog-drift {
0% { transform: translate(0, 0) scaleX(1); }
25% { transform: translate(14px, -2px) scaleX(1.08); }
50% { transform: translate(0, 0) scaleX(1); }
75% { transform: translate(-14px, 1px) scaleX(0.95); }
100% { transform: translate(0, 0) scaleX(1); }
}
/* Respect user preference */
@media (prefers-reduced-motion: reduce) {
.mist-ring, .bubble, .fog-band { animation: none; }
}
/* Bags */
.bag-group {
cursor: pointer;
@@ -855,7 +928,6 @@
.ajar-badge { animation: ajar-rise 0.4s ease-out both; }
/* Soft breathing on the grow-light bloom and the humidifier's mist halo */
.grow-bloom-anim { animation: ambient-breathe 6s ease-in-out infinite; }
.mist-bloom-anim { animation: ambient-breathe 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
/* Low-water reservoir halo: a slow amber pulse drawing the eye */