feat: duck-head modal logo, input lockout mid-roll, quieter quack

- welcome modal uses the site's duck-head mark (open variant on hover)
  instead of the wordmark sticker
- all movement/mode inputs are ignored while a roll is in flight; the
  existing deterministic completion check (tipped then upright, 3 s cap)
  releases the lock, no arbitrary timer
- quack.wav only plays on the gamepad right trigger; mode/colour changes
  keep the silent jaw flap

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
tfrere
2026-08-20 13:55:16 +02:00
parent ee2d470a87
commit 201c372933
6 changed files with 37 additions and 11 deletions
+1
View File
@@ -36,3 +36,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.stl filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text
Binary file not shown.
Binary file not shown.
Binary file not shown.
+16 -6
View File
@@ -281,12 +281,18 @@
from { transform: translateY(18px) scale(0.94); opacity: 0; }
to { transform: none; opacity: 1; }
}
#welcome .logo-wordmark {
display: block;
width: min(78%, 300px);
/* Duck-head mark from the site header: closed by default, open on
hover (same swap as the site). */
#welcome .logo-head {
position: relative;
width: 7.2rem;
margin: 0.3rem auto 0;
filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.45));
}
#welcome .logo-head img { display: block; width: 100%; }
#welcome .logo-head .open { position: absolute; inset: 0; opacity: 0; }
#welcome .logo-head:hover .open { opacity: 1; }
#welcome .logo-head:hover .closed { opacity: 0; }
#welcome .subtitle {
margin-top: 0.55rem;
font-size: 0.62rem;
@@ -400,7 +406,10 @@
<div id="welcome" hidden>
<div class="card" role="dialog" aria-modal="true" aria-label="Microduck playground">
<img class="logo-wordmark" id="logo-wordmark" alt="Microduck" />
<div class="logo-head">
<img class="closed" id="logo-head-closed" alt="Microduck" />
<img class="open" id="logo-head-open" alt="" aria-hidden="true" />
</div>
<div class="subtitle">RL playground</div>
<p class="tagline">
A real robot brain in your browser: MuJoCo physics compiled to
@@ -427,7 +436,8 @@
// on the private Space (rl.js hasn't installed its signer yet).
const sign = new URLSearchParams(location.search).get("__sign");
const signedUrl = (u) => (sign ? `${u}?__sign=${encodeURIComponent(sign)}` : u);
document.getElementById("logo-wordmark").src = signedUrl("./assets/logo-wordmark.png");
document.getElementById("logo-head-closed").src = signedUrl("./assets/duck-head-mark.webp");
document.getElementById("logo-head-open").src = signedUrl("./assets/duck-head-mark-open.webp");
const open = () => {
modal.hidden = false;
modal.classList.remove("closing");
@@ -458,7 +468,7 @@
appended: a plain src attribute can 401 when the browser blocks the
*.static.hf.space auth cookie inside the hub iframe. -->
<script type="module">
const V = "22"; // bump on rl.js changes to defeat heuristic caching
const V = "23"; // bump on rl.js changes to defeat heuristic caching
const sign = new URLSearchParams(location.search).get("__sign");
const suffix = sign ? `&__sign=${encodeURIComponent(sign)}` : "";
import(`./rl.js?v=${V}${suffix}`);
+14 -2
View File
@@ -208,7 +208,11 @@ let sitFlag = 0;
// The twist the policy actually receives: live gamepad sticks win over the
// held keys. No input means zero command - the duck stands in place.
// Shared by buildObs and the HUD mini-sticks so they can never disagree.
// Mid-roll every movement input is ignored (zero twist) until the roll
// hands back to walk on its own - steering would only knock the roll over.
const ZERO_CMD = new Float32Array(3);
function effectiveCmd() {
if (mode === "roll") return ZERO_CMD;
return padActive ? padCmd : velCmd;
}
// One-shot roll tracking: trigger time + whether the trunk actually
@@ -465,8 +469,13 @@ let padJaw = 0;
// is swallowed and sound simply starts working after the first click/key.
const quackSound = new Audio(signed("./assets/quack.wav"));
quackSound.volume = 0.7;
// Silent jaw flap for mode/colour changes; the actual quack sound only
// plays on the gamepad right trigger (anything more gets noisy fast).
const quack = () => {
quackAt = performance.now();
};
const quackLoud = () => {
quack();
quackSound.currentTime = 0;
quackSound.play().catch(() => {});
};
@@ -505,7 +514,7 @@ function renderStats() {
// Mini sticks: the dot mirrors the effective twist, lit yellow while the
// user is actually driving.
const manual = padActive || held.size > 0;
const manual = (padActive || held.size > 0) && mode !== "roll";
const yN = vx >= 0 ? vx / VEL_FWD : vx / -VEL_BACK;
dotMove.style.transform = `translate(${(-vy / VEL_LAT) * STICK_R}px, ${-yN * STICK_R}px)`;
dotTurn.style.transform = `translate(${(-wz / VEL_ANG) * STICK_R}px, 0px)`;
@@ -636,7 +645,7 @@ pollPad = function pollGamepad() {
const rt = gp.buttons[7]?.value ?? 0;
const lt = gp.buttons[6]?.value ?? 0;
padJaw = Math.max(rt, lt);
if (padPrev.rt < 0.3 && rt >= 0.3) quack();
if (padPrev.rt < 0.3 && rt >= 0.3) quackLoud();
padPrev.rt = rt;
};
@@ -645,6 +654,9 @@ pollPad = function pollGamepad() {
const modeLabel = document.getElementById("mode-label");
function setMode(next) {
// No policy switching mid-roll: the roll ends on its own (upright again
// or expired) and returns to walk - switching now would floor the duck.
if (mode === "roll" && rollRun) return;
quack();
rollRun = null;
if (next !== "sit") {