[app] PlanetGarden: e2e passes the gardener question, opens the ring, and pours by tilting the can
This commit is contained in:
@@ -102,6 +102,23 @@
|
||||
touch: { at: -10, pose: 'reach' }
|
||||
};
|
||||
const station = $derived(STATION[activity]);
|
||||
/** Where on the world the gardener stands, in degrees from the top: walked there, or placed at once with reduced motion. */
|
||||
let walkAt = $state(STATION.idle.at);
|
||||
$effect(() => {
|
||||
const target = station.at;
|
||||
const from = untrack(() => walkAt);
|
||||
if (reduced || from === target) {
|
||||
walkAt = target;
|
||||
return;
|
||||
}
|
||||
const t0 = performance.now();
|
||||
const step = setInterval(() => {
|
||||
const k = Math.min(1, (performance.now() - t0) / 900);
|
||||
walkAt = from + (target - from) * (k < 0.5 ? 2 * k * k : 1 - (-2 * k + 2) ** 2 / 2);
|
||||
if (k >= 1) clearInterval(step);
|
||||
}, 16);
|
||||
return () => clearInterval(step);
|
||||
});
|
||||
|
||||
// --- The player's hand ------------------------------------------------------
|
||||
type Drag =
|
||||
@@ -248,7 +265,6 @@
|
||||
|
||||
<!-- Her small round world: meadow over warm earth, a low dry-stone wall, her bed, the chair. -->
|
||||
<circle cx={CX} cy={CY} r={R} fill="url(#planet-ground)" stroke="#3a2730" stroke-width="3" />
|
||||
<path d="M{CX - 70} {CY + 40} q 70 50 140 0" fill="none" stroke="#8a6248" stroke-width="10" opacity=".25" />
|
||||
{#each [-58, -52, -46, 46, 52] as a (a)}
|
||||
{@const s = surface(a, 3)}
|
||||
<ellipse cx={s.x} cy={s.y} rx="6" ry="4" fill="#c9bcae" stroke="#3a2730" stroke-width="1.5" transform="rotate({a} {s.x} {s.y})" />
|
||||
@@ -343,7 +359,7 @@
|
||||
{/if}
|
||||
|
||||
<!-- The gardener: walks round the world to where the work is. -->
|
||||
<g class="walker" style:transform="rotate({station.at}deg)" style:transform-origin="{CX}px {CY}px">
|
||||
<g class="walker" transform="rotate({walkAt} {CX} {CY})">
|
||||
<g transform="translate({CX} {TOP})">
|
||||
<Gardener {look} pose={station.pose} {tilt} />
|
||||
</g>
|
||||
@@ -382,14 +398,6 @@
|
||||
transform: rotate(-4deg);
|
||||
}
|
||||
|
||||
.walker {
|
||||
transition: transform 0.9s ease-in-out;
|
||||
}
|
||||
|
||||
.reduced .walker {
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.gust path {
|
||||
animation: gust 2.4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user