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

+3 -4
View File
@@ -58,10 +58,9 @@
--cab-dark: #111411; /* dark compartment interior */ --cab-dark: #111411; /* dark compartment interior */
/* Substrate / bag fills */ /* Substrate / bag fills */
--bag-grain: #d4c39b; /* uncolonized grain colour */ --bag-grain: #161212; /* uncolonized grain colour */
--bag-mycelium: #f4ece0; /* white mycelium wash */ --bag-mycelium: #faf7f4; /* white mycelium wash */
--bag-pin: #eadfc9; --bag-fruit: #ffffff; /* white mushroom cap */
--bag-fruit: #b78f6a; /* warm mushroom cap */
--font-serif: 'DM Serif Display', 'Baskervville', Georgia, serif; --font-serif: 'DM Serif Display', 'Baskervville', Georgia, serif;
--font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
+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 { function contamColor(bag: BagState): string | null {
if (bag.vision.contamination_risk === 'high') return '#d55a5a'; if (bag.vision.contamination_risk === 'high') return '#d55a5a';
if (bag.vision.contamination_risk === 'low') return '#d99050'; if (bag.vision.contamination_risk === 'low') return '#d99050';
@@ -118,28 +126,97 @@
// Low atmospheric fog bands — horizontal wisps that drift, not rise. // Low atmospheric fog bands — horizontal wisps that drift, not rise.
// This reads more like ambient humidity than individual particles. // This reads more like ambient humidity than individual particles.
const FOG_BANDS = [ const FOG_BANDS = [
{ yFrac: 0.88, rx: 70, ry: 10, opacity: 0.78, dur: 9, delay: 0 }, { yFrac: 0.97, rx: 70, ry: 10, opacity: 0.8, dur: 20, delay: 0 },
{ yFrac: 0.80, rx: 64, ry: 8, opacity: 0.55, dur: 11, delay: 2 }, { yFrac: 0.93, rx: 70, ry: 10, opacity: 0.55, dur: 30, delay: 2 },
{ yFrac: 0.70, rx: 56, ry: 6, opacity: 0.35, dur: 13, delay: 4 }, { yFrac: 0.88, rx: 56, ry: 10, opacity: 0.35, dur: 13, delay: 4 },
{ yFrac: 0.60, rx: 48, ry: 5, opacity: 0.22, dur: 15, delay: 6 }, { 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 // 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 // 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. // y=20.9 when empty and rises toward y=4.4 when full.
const resPct = $derived(hw.humidifier.reservoir_pct); const resPct = $derived(hw.humidifier.reservoir_pct);
const resLow = $derived(resPct < 15); const resLow = $derived(resPct < 15);
const waterY = $derived(20.9 - (resPct / 100) * 16.5); 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> </script>
<div class="twin-wrap"> <div class="twin-wrap">
@@ -150,10 +227,10 @@
aria-label="Your Cultivar — {occupiedCol + occupiedFruit} of {totalCol + totalFruit} bags growing" aria-label="Your Cultivar — {occupiedCol + occupiedFruit} of {totalCol + totalFruit} bags growing"
> >
<defs> <defs>
<linearGradient id="body-grad" x1="0" y1="0" x2="1" y2="1"> <linearGradient id="body-grad" x1="0" y1="0" x2="1" y2="0.3">
<stop offset="0%" stop-color="#fbf7ec"/> <stop offset="0%" stop-color="#cac9d1"/>
<stop offset="55%" stop-color="#f4efe3"/> <stop offset="65%" stop-color="#fff"/>
<stop offset="100%" stop-color="#e6ddc8"/> <stop offset="100%" stop-color="#f0f4f7"/>
</linearGradient> </linearGradient>
<linearGradient id="col-inner" x1="0.5" y1="0" x2="0.5" y2="1"> <linearGradient id="col-inner" x1="0.5" y1="0" x2="0.5" y2="1">
@@ -161,11 +238,19 @@
<stop offset="100%" stop-color="#161a12"/> <stop offset="100%" stop-color="#161a12"/>
</linearGradient> </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"> <linearGradient id="fruit-inner" x1="0.5" y1="0" x2="0.5" y2="1">
<stop offset="0%" stop-color="#f0e8d2"/> <stop offset="0%" stop-color="#fff"/>
<stop offset="100%" stop-color="#e1d6b9"/> <stop offset="100%" stop-color="#fff"/>
</linearGradient> </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"> <linearGradient id="glass-shine" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#ffffff" stop-opacity="0.16"/> <stop offset="0%" stop-color="#ffffff" stop-opacity="0.16"/>
<stop offset="22%" stop-color="#ffffff" stop-opacity="0.04"/> <stop offset="22%" stop-color="#ffffff" stop-opacity="0.04"/>
@@ -222,8 +307,10 @@
<feGaussianBlur in="SourceGraphic" stdDeviation="2.4"/> <feGaussianBlur in="SourceGraphic" stdDeviation="2.4"/>
</filter> </filter>
<!-- Soft drop shadow under a bag — like it's resting on the shelf --> <!-- 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%"> 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"/> <feGaussianBlur in="SourceAlpha" stdDeviation="0.7"/>
<feOffset dx="0" dy="1.2"/> <feOffset dx="0" dy="1.2"/>
<feComponentTransfer><feFuncA type="linear" slope="0.35"/></feComponentTransfer> <feComponentTransfer><feFuncA type="linear" slope="0.35"/></feComponentTransfer>
@@ -252,31 +339,31 @@
</linearGradient> </linearGradient>
<!-- Warm bloom at the top of the fruiting compartment when the grow light is on --> <!-- 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%"> <radialGradient id="grow-bloom" cx="50%" cy="0%" r="80%">
<stop offset="0%" stop-color="#ffe9b6" stop-opacity="0.65"/> <stop offset="0%" stop-color="#e8f4fc" stop-opacity="1"/>
<stop offset="40%" stop-color="#ffd890" stop-opacity="0.22"/> <stop offset="30%" stop-color="#d4e9f7" stop-opacity="0.5"/>
<stop offset="100%" stop-color="#ffd890" stop-opacity="0"/> <stop offset="100%" stop-color="#d4e9f7" stop-opacity="0"/>
</radialGradient> </radialGradient>
<!-- Ultrasonic mist bloom --> <!-- Ultrasonic mist bloom -->
<radialGradient id="mist-bloom" cx="50%" cy="50%" r="60%"> <radialGradient id="mist-bloom" cx="50%" cy="50%" r="60%">
<stop offset="0%" stop-color="#c0e4d3" stop-opacity="0.55"/> <stop offset="0%" stop-color="#8edffa" stop-opacity="0.95"/>
<stop offset="60%" stop-color="#c0e4d3" stop-opacity="0.12"/> <stop offset="60%" stop-color="#8edffa" stop-opacity="0.12"/>
<stop offset="100%" stop-color="#c0e4d3" stop-opacity="0"/> <stop offset="100%" stop-color="#8edffa" stop-opacity="0"/>
</radialGradient> </radialGradient>
<!-- Soft blur for mist particles. Keep stdDeviation modest so the <!-- Soft blur for mist particles. Keep stdDeviation modest so the
puff doesn't dilute below visibility. --> puff doesn't dilute below visibility. -->
<filter id="mist-soften" x="-50%" y="-50%" width="200%" height="200%"> <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> </filter>
<!-- Radial fade for a single mist puff. Denser centre + a strong <!-- Radial fade for a single mist puff. Denser centre + a strong
cream tone so it reads against the warm interior. --> cream tone so it reads against the warm interior. -->
<radialGradient id="mist-puff" cx="50%" cy="50%" r="60%"> <radialGradient id="mist-puff" cx="50%" cy="70%" r="70%">
<stop offset="0%" stop-color="#ffffff" stop-opacity="1"/> <stop offset="0%" stop-color="#8edffa" stop-opacity="0.6"/>
<stop offset="50%" stop-color="#f4efe0" stop-opacity="0.75"/> <stop offset="40%" stop-color="#8edffa" stop-opacity="0.4"/>
<stop offset="100%" stop-color="#f4efe0" stop-opacity="0"/> <stop offset="100%" stop-color="#8edffa" stop-opacity="0"/>
</radialGradient> </radialGradient>
<!-- Clip the mist so it never spills outside the fruiting interior --> <!-- Clip the mist so it never spills outside the fruiting interior -->
@@ -335,6 +422,9 @@
<rect x={LEFT.x} y={LEFT.y} <rect x={LEFT.x} y={LEFT.y}
width={LEFT.w} height={LEFT.h} rx="4" width={LEFT.w} height={LEFT.h} rx="4"
fill="url(#col-inner)" stroke="#2e2a20" stroke-width="0.6"/> 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) --> <!-- 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} <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" <rect x={LEFT.x} y={LEFT.y} width={LEFT.w} height={LEFT.h} rx="4"
fill="url(#col-led)" pointer-events="none"/> 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} <line x1={LEFT.x + 2} y1={sy} x2={LEFT.x + LEFT.w - 2} y2={sy}
stroke="#2d2f25" stroke-width="0.8" opacity="0.9"/> stroke="#2d2f25" stroke-width="0.8" opacity="0.9"/>
{/each} {/each}
{#each colGrid as row, ri} {#each colGrid as row, ri (ri)}
{#each row as bag, ci} {#each row as bag, ci (ci)}
{@const br = bagRect(LEFT, ri, ci)} {@const br = BAG_RECTS_LEFT[ri][ci]}
{#if bag} {#if bag}
{@const cc = contamColor(bag)} {@const cc = contamColor(bag)}
{@const fh = Math.max(4, (br.h - 4) * bag.vision.colonization_pct / 100)} {@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"/> fill="var(--bag-grain)" fill-opacity="0.78"/>
<rect x={br.x + 1.5} y={br.y + 1.5 + (br.h - 3 - fh)} <rect x={br.x + 1.5} y={br.y + 1.5 + (br.h - 3 - fh)}
width={br.w - 3} height={fh} rx="2.5" 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>
<g filter="url(#label-shadow)" pointer-events="none"> <g filter="url(#label-shadow)" pointer-events="none">
@@ -438,12 +528,15 @@
<rect x={RIGHT.x} y={RIGHT.y} <rect x={RIGHT.x} y={RIGHT.y}
width={RIGHT.w} height={RIGHT.h} rx="4" width={RIGHT.w} height={RIGHT.h} rx="4"
fill="url(#fruit-inner)" stroke="#beb395" stroke-width="0.6"/> 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 --> <!-- Top LED strip -->
<line x1={RIGHT.x + 4} y1={RIGHT.y + 3} x2={RIGHT.x + RIGHT.w - 4} y2={RIGHT.y + 3} <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={fruitGrowLight?.on ? '#5bd4fc' : '#cfd9c0'}
stroke-width={fruitGrowLight?.on ? 1.6 : 0.9} stroke-width={fruitGrowLight?.on ? 1.2 : 0.9}
stroke-opacity={fruitGrowLight?.on ? 0.95 : 0.5} stroke-opacity={fruitGrowLight?.on ? 1 : 0.5}
stroke-linecap="round"/> stroke-linecap="round"/>
<rect x={RIGHT.x} y={RIGHT.y} width={RIGHT.w} height={RIGHT.h} rx="4" <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 --> <!-- Warm bloom emanating from the top LED strip when the grow light is on -->
{#if fruitGrowLight?.on} {#if fruitGrowLight?.on}
<rect x={RIGHT.x + 2} y={RIGHT.y + 2} width={RIGHT.w - 4} height={46} <rect x={RIGHT.x + 2} y={RIGHT.y + 2} width={RIGHT.w - 4} height={100}
fill="url(#grow-bloom)" pointer-events="none" class="grow-bloom-anim"/> fill="url(#grow-bloom)" pointer-events="none" />
{/if} {/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} <line x1={RIGHT.x + 2} y1={sy} x2={RIGHT.x + RIGHT.w - 2} y2={sy}
stroke="#b0a588" stroke-width="0.8" opacity="0.8"/> stroke="#b0a588" stroke-width="0.8" opacity="0.8"/>
{/each} {/each}
{#each fruitGrid as row, ri} {#each fruitGrid as row, ri (ri)}
{#each row as bag, ci} {#each row as bag, ci (ci)}
{@const br = bagRect(RIGHT, ri, ci)} {@const br = BAG_RECTS_RIGHT[ri][ci]}
{#if bag} {#if bag}
{@const cc = contamColor(bag)} {@const cc = contamColor(bag)}
{@const pct = bag.vision.colonization_pct} {@const pct = bag.vision.colonization_pct}
{@const fh = Math.max(4, (br.h - 4) * pct / 100)} {@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 <g
role="button" role="button"
tabindex="0" tabindex="0"
@@ -477,19 +570,29 @@
onkeydown={(e) => (e.key === 'Enter' || e.key === ' ') && handleBagTap(bag, e)} onkeydown={(e) => (e.key === 'Enter' || e.key === ' ') && handleBagTap(bag, e)}
> >
<g filter="url(#bag-shadow)"> <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" <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)} <rect x={br.x + 1.5} y={br.y + 1.5 + (br.h - 3 - fh)}
width={br.w - 3} height={fh} rx="2.5" 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"> <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"/> {#each fruits as f, i (i)}
<ellipse cx={br.w * 0.55} cy="0.5" rx="6.5" ry="3.5" fill="#a17853" opacity="0.95"/> <ellipse
<ellipse cx={br.w * 0.78} cy="2.5" rx="4.5" ry="2.8" fill="var(--bag-fruit)" opacity="0.88"/> 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> </g>
{/if} {/if}
</g> </g>
@@ -523,7 +626,7 @@
</g> </g>
{:else} {:else}
<rect x={br.x + 2} y={br.y + 2} width={br.w - 4} height={br.h - 4} rx="3" <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"/> stroke-dasharray="3 3" stroke-opacity="0.55"/>
{/if} {/if}
{/each} {/each}
@@ -559,21 +662,17 @@
<!-- ═══ BASE · humidifier + fans ═══ --> <!-- ═══ BASE · humidifier + fans ═══ -->
<g class="base-hw" aria-hidden="true"> <g class="base-hw" aria-hidden="true">
<!-- Humidifier icon (center of base) — ultrasonic disc --> <!-- 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} {#if humidOn}
<!-- Ambient mist bloom --> <!-- Ambient mist bloom -->
<circle r="14" fill="url(#mist-bloom)" pointer-events="none" class="mist-bloom-anim"/> <circle r="14" fill="url(#mist-bloom)" pointer-events="none" class="mist-bloom-anim"/>
{/if} {/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} {#if humidOn}
{#each [0, 1, 2] as i} {#each [0, 1, 2] as i (i)}
<circle r="6" fill="none" stroke="#7bb3a2" stroke-width="0.6" opacity="0"> <circle class="mist-ring" r="6" fill="none" stroke="#7bb3a2" stroke-width="0.6"
<animate attributeName="r" values="6;12" dur="2.2s" begin="{i * 0.6}s" repeatCount="indefinite"/> style="animation-delay: {i * 0.6}s"/>
<animate attributeName="opacity" values="0.55;0" dur="2.2s" begin="{i * 0.6}s" repeatCount="indefinite"/>
</circle>
{/each} {/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} {/if}
</g> </g>
@@ -581,7 +680,7 @@
a live water level, meniscus highlight, and rising bubbles a live water level, meniscus highlight, and rising bubbles
while the humidifier is running. Derived values (`resPct`, while the humidifier is running. Derived values (`resPct`,
`resLow`, `waterY`) live in the script block. --> `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}> class:reservoir-low={resLow}>
<!-- Bottle silhouette: short neck, curved shoulders, rounded body --> <!-- Bottle silhouette: short neck, curved shoulders, rounded body -->
<path <path
@@ -617,26 +716,15 @@
<rect x="0" y={waterY + 0.5} width="14" height="0.35" <rect x="0" y={waterY + 0.5} width="14" height="0.35"
fill="#ffffff" opacity="0.22"/> 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} {#if humidOn && !resLow}
<circle cx="4.8" cy="20" r="0.45" fill="#ffffff" opacity="0"> <circle class="bubble" cx="4.8" cy="20" r="0.45" fill="#ffffff"
<animate attributeName="cy" values="20;{waterY + 0.8}" style="--rise: {bubbleRise}px; --dur: 3.2s; --delay: 0s; --peak: 0.85"/>
dur="3.2s" begin="0s" repeatCount="indefinite"/> <circle class="bubble" cx="9.1" cy="20" r="0.35" fill="#ffffff"
<animate attributeName="opacity" values="0;0.85;0" style="--rise: {bubbleRise}px; --dur: 4.1s; --delay: 1.4s; --peak: 0.75"/>
keyTimes="0;0.3;1" dur="3.2s" begin="0s" repeatCount="indefinite"/> <circle class="bubble" cx="7" cy="20" r="0.3" fill="#ffffff"
</circle> style="--rise: {bubbleRise}px; --dur: 4.6s; --delay: 2.7s; --peak: 0.7"/>
<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>
{/if} {/if}
</g> </g>
@@ -665,7 +753,7 @@
<!-- Colonization fan (bottom-left of base) --> <!-- Colonization fan (bottom-left of base) -->
<g transform="translate(100, 377)" aria-label="Colonization fan"> <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}"> <g class="fan-blades" class:spinning={colFanSpinning} style="--fan-dur: {colFanDur}">
{#each [0, 90, 180, 270] as a} {#each [0, 90, 180, 270] as a}
<path transform="rotate({a})" <path transform="rotate({a})"
@@ -679,7 +767,7 @@
<!-- Fruiting fan (bottom-right of base) --> <!-- Fruiting fan (bottom-right of base) -->
<g transform="translate(380, 377)" aria-label="Fruiting fan"> <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}"> <g class="fan-blades" class:spinning={fruitFanSpinning} style="--fan-dur: {fruitFanDur}">
{#each [0, 90, 180, 270] as a} {#each [0, 90, 180, 270] as a}
<path transform="rotate({a})" <path transform="rotate({a})"
@@ -697,82 +785,17 @@
and layering low horizontal fog bands that drift sideways, and layering low horizontal fog bands that drift sideways,
rather than individual particles that rise straight up. --> rather than individual particles that rise straight up. -->
{#if humidOn} {#if humidOn}
{@const ventW = 60} <!-- Low fog bands — horizontal drift, not vertical rise.
{@const ventX = RIGHT.x + (RIGHT.w - ventW) / 2} Animated via CSS transform on a wrapper <g> so the
{@const ventY = RIGHT.y + RIGHT.h - 8} compositor (not SMIL's main-thread interpolator) can drive it. -->
<!-- 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 -->
<g filter="url(#mist-soften)" clip-path="url(#mist-clip)" pointer-events="none"> <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 cx = RIGHT.x + RIGHT.w / 2}
{@const cy = RIGHT.y + RIGHT.h * f.yFrac} {@const cy = RIGHT.y + RIGHT.h * f.yFrac}
<ellipse <g class="fog-band" style="transform-origin: {cx}px {cy}px; animation-duration: {f.dur}s; animation-delay: {f.delay}s">
cx={cx} cy={cy} <ellipse cx={cx} cy={cy} rx={f.rx} ry={f.ry}
rx={f.rx} ry={f.ry} fill="url(#mist-puff)" opacity={f.opacity}/>
fill="url(#mist-puff)" </g>
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>
{/each} {/each}
</g> </g>
{/if} {/if}
@@ -809,6 +832,9 @@
gap: 10px; gap: 10px;
width: 100%; width: 100%;
min-width: 0; min-width: 0;
/* Skip painting the whole twin while it's scrolled offscreen */
content-visibility: auto;
contain-intrinsic-size: 680px 500px;
} }
.appliance { .appliance {
@@ -820,6 +846,53 @@
overflow: visible; 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 */ /* Bags */
.bag-group { .bag-group {
cursor: pointer; cursor: pointer;
@@ -855,7 +928,6 @@
.ajar-badge { animation: ajar-rise 0.4s ease-out both; } .ajar-badge { animation: ajar-rise 0.4s ease-out both; }
/* Soft breathing on the grow-light bloom and the humidifier's mist halo */ /* 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; } .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 */ /* Low-water reservoir halo: a slow amber pulse drawing the eye */
+2 -4
View File
@@ -6,7 +6,6 @@
const hour = now.getHours(); const hour = now.getHours();
const day = now.getDay(); const day = now.getDay();
const isWeekend = day === 0 || day === 6; const isWeekend = day === 0 || day === 6;
const isWeekday = !isWeekend;
const morningGreetings = [ const morningGreetings = [
'Good morning', 'Good morning',
@@ -53,7 +52,6 @@
'In spore-tacular shape', 'In spore-tacular shape',
'Cap-tivating', 'Cap-tivating',
'Truffle shuffle', 'Truffle shuffle',
'Hyphae happenin',
'Portobello vibes', 'Portobello vibes',
]; ];
@@ -78,8 +76,8 @@
// Mix in mushroom-themed greetings // Mix in mushroom-themed greetings
greetings = [...greetings, ...mushroomGreetings]; greetings = [...greetings, ...mushroomGreetings];
// Pick a greeting based on the day to keep it consistent throughout the day // Pick a random greeting
const greetingIndex = (hour + day) % greetings.length; const greetingIndex = Math.floor(Math.random() * greetings.length);
const greeting = greetings[greetingIndex]; const greeting = greetings[greetingIndex];
// Display cultivar owner name if we had one — for now, friendly generic // Display cultivar owner name if we had one — for now, friendly generic
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB