diff --git a/internal/gui/assets/plugins/routing/client.js b/internal/gui/assets/plugins/routing/client.js index 786818c20..e2a0513df 100644 --- a/internal/gui/assets/plugins/routing/client.js +++ b/internal/gui/assets/plugins/routing/client.js @@ -5614,9 +5614,11 @@ function routingPage(part) { + ""; function bird(kind) { - if (still() || !shown()) return null; + if (!shown()) return null; const g = document.createElementNS(NS, "g"); - g.setAttribute("class", "rt-flier " + kind); + // with motion reduced the magpie doesn't fly or beat its wings: it fades + // in where the dot is put and fades out (routing.css .calm) + g.setAttribute("class", "rt-flier " + kind + (still() ? " calm" : "")); g.innerHTML = FLIER; sky.appendChild(g); return g; @@ -5624,8 +5626,10 @@ function routingPage(part) { // off it goes, up and away, once it has let go of the dot function away(b) { if (!b) return; - b.classList.add("away"); - setTimeout(() => b.remove(), 450); + // a calm one has been put down, not flown: it stays a while to be seen + const wait = b.classList.contains("calm") ? 700 : 0; + setTimeout(() => b.classList.add("away"), wait); + setTimeout(() => b.remove(), wait + 450); } function packet() { const dot = document.createElementNS(NS, "circle"); diff --git a/internal/gui/assets/plugins/routing/routing.css b/internal/gui/assets/plugins/routing/routing.css index 66d8c2987..3d2588d77 100644 --- a/internal/gui/assets/plugins/routing/routing.css +++ b/internal/gui/assets/plugins/routing/routing.css @@ -55,6 +55,11 @@ .rt-flier .wing.far { animation-delay: -.03s; } @keyframes rtflap { 0%, 100% { transform: scaleY(1); } 55% { transform: scaleY(-.62) skewX(-8deg); } } .rt-flier .rt-lift { animation: rtcome .3s ease-out; transition: transform .45s cubic-bezier(.3, 0, .2, 1), opacity .45s; } +/* motion reduced: the magpie only fades in and out, wings still (opacity alone) */ +.rt-flier.calm .wing { animation: none; } +.rt-flier.calm .rt-lift { animation: rtfade .2s cubic-bezier(.23, 1, .32, 1); transition: opacity .25s cubic-bezier(.23, 1, .32, 1); } +.rt-flier.calm.away .rt-lift { transform: none; opacity: 0; } +@keyframes rtfade { from { opacity: 0; } } .rt-flier.away .rt-lift { transform: translate(14px, -16px) scale(.8); opacity: 0; } @keyframes rtcome { from { transform: translate(-6px, -10px) scale(.85); opacity: 0; } } .rt-srcs { position: relative; z-index: 1; min-width: 0; display: grid; gap: 10px; } diff --git a/internal/gui/tests/routing-calm-in-flight.test.cjs b/internal/gui/tests/routing-calm-in-flight.test.cjs index c1debb2b3..caac51e8a 100644 --- a/internal/gui/tests/routing-calm-in-flight.test.cjs +++ b/internal/gui/tests/routing-calm-in-flight.test.cjs @@ -4,7 +4,7 @@ // animation", every wire dotted and still while two accounts answered). // Reduced motion is the system's (Windows' "Animation effects" off, which // WebView2 reports as prefers-reduced-motion) or Settings' Reduce motion. -// Nothing moves along a wire then, but the flowing wires fade and come +// Nothing moves along a wire then (the magpie fades in and out, wings still), but the flowing wires fade and come // back, and so does the dot held at the account answering. Once the // request is over nothing fades. No backend, the API is faked here. const assert = require("node:assert/strict"); @@ -73,6 +73,21 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", // two requests at once, one at each account: the reporter's two // rows "answering another request…" send(route(2, [at(1, false)]), route(3, [at(2, false)])); + // the magpie that brings each request is there, still: it fades in + // by opacity alone, its wings don't beat, and it fades away again + await page.waitForFunction(() => document.querySelector(".rt-sky .rt-flier.calm")); + const bird = await page.evaluate(() => { + const b = document.querySelector(".rt-sky .rt-flier.calm"); + const css = (e) => getComputedStyle(e); + const rule = [...document.styleSheets].flatMap((sh) => { try { return [...sh.cssRules]; } catch { return []; } }).find((r) => r.name === "rtfade"); + return { lift: css(b.querySelector(".rt-lift")).animationName, wings: [...b.querySelectorAll(".wing")].map((w) => css(w).animationName), + keys: rule ? [...rule.cssRules].map((k) => k.style.cssText) : null }; + }); + assert.equal(bird.lift, "rtfade", "the bird fades in"); + assert.deepEqual(bird.wings, ["none", "none"], "its wings are still"); + assert(bird.keys && bird.keys.every((k) => /opacity/.test(k) && !/transform/.test(k)), `fade by opacity alone: ${bird.keys}`); + await page.waitForFunction(() => document.querySelector(".rt-sky .rt-flier.calm.away"), null, { timeout: 5000 }); + await page.waitForFunction(() => !document.querySelector(".rt-sky .rt-flier"), null, { timeout: 5000 }); await page.waitForFunction(() => document.querySelectorAll(".rt-accts li.now").length === 2); await page.waitForFunction(() => document.querySelectorAll(".rt-flows path[d]").length >= 2); // the wires' dashes stand still: no animation and no offset @@ -91,8 +106,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", const held = () => page.evaluate(() => getComputedStyle(document.querySelector(".rt-sky .pkt.held")).opacity); const heldWas = await held(); await page.waitForFunction((was) => getComputedStyle(document.querySelector(".rt-sky .pkt.held")).opacity !== was, heldWas); - // no bird flies with motion reduced - assert.equal(await page.locator(".rt-flier").count(), 0); + // no bird is left on the stage once it has faded + assert.equal(await page.locator(".rt-flier:not(.calm)").count(), 0); // both are answered: nothing fades any more, the layer is whole send(route(2, [at(1, true)]), route(3, [at(2, true)]));