20 KiB
UI motion audit (egui chrome)
Read-only audit of the motion in Nacre's egui UI, done for the orchestrator on 2026-11-13 at commit ab158f5
(code not compiled or run for this; every finding was re-read at its file:line). Standard: the review-animations
rules (Emil Kowalski's animation philosophy) as already translated for egui in D-023 / Plans/07 Polish pass/S039-motion.md
"Motion rules". Where this doc says "rule N" it means S039's Motion rules.
1. Recon
-
One motion system already exists:
theme::spring/effect/spring_jump(src/theme.rs:420-514), semi-implicit Euler, retargets keeping velocity (interruptible), repaints only while unsettled, Motion setting scales time (Off = 0 → returns the target). egui's ownanimation_time= 0.1 s × Motion factor (theme.rs:447). -
Presets (
theme.rs:427-434), computed at Normal:Preset k / ζ ~settle (2 %) Overshoot Used for today FAST1400 / 0.62 170 ms 8 % press, switch thumb DEFAULT700 / 0.68 220 ms 5 % flyout grow, tab slides, tab/settings selection pills, customize sheet, NTP column, progress ring, waves SLOW300 / 0.74 310 ms 3 % nothing (gallery only) EFFECT900 / 1.0 190 ms 0 hover/selection tints, flyout fade, dialog enter There is no critically damped preset for movement: every spatial move overshoots. On a pixel value the overshoot scales with the distance (a 430 px pill jump overshoots ~23 px).
-
Frame pacing:
src/egui_area.rsis a GTKGLAreawithauto_render(false).request_repaint→ egui callback (egui_area.rs:280-289) → glib timeout →queue_render, which GTK coalesces onto its frame clock. The frame'srepaint_delayis also scheduled (egui_area.rs:181-189), so an animating frame sets two timers; harmless (coalesced). Every repaint reruns and retessellates the whole chrome. -
Personality: Material You / M3 Expressive, reference app Damson. Lively but crisp; bounce is allowed for drag release and rare delight only (D-023).
-
Frequency map
Tier Surfaces 100+/day, often keyboard tab switch (click, Ctrl+Tab, Ctrl+1-9), Ctrl+T/W, address field focus + suggestion dropdown + arrow-key row selection, page loads (address-bar wave, tab spinner), find bar tens/day hover/press on every control, page context menu, tab context menu, flyouts (main, downloads, shield, site info), toasts, ad-block badge occasional dialogs, settings rail/sections, customize sheet, download list, media flyout, permission bars rare welcome, first run, download finished
2. Findings (ordered by leverage)
Severity: HIGH = feel-breaking or breaks a D-023 rule on a 100+/day surface; MEDIUM = noticeably off; LOW = polish. "Covered" says whether S039/S043 already contain this as a step (rule text alone without a step = "rule only").
| # | Sev | Location | Before | After | Why | Covered |
|---|---|---|---|---|---|---|
| 1 | HIGH | src/ui/chrome.rs:216-223, chrome.rs:273 |
Tab selection pill slides between tabs with DEFAULT (5 % overshoot of the distance) and the tab content colour crossfades with EFFECT, on every switch, including Ctrl+Tab / Ctrl+1-9 |
Pill and tab-on tint jump when the active tab changes; the pill still slides (new MOVE preset) when the active tab's rect moves (another tab closed/opened/reordered, drag) |
Rule 1: tab switch is 100+/day and keyboard-driven → instant. A switch to a far tab currently sweeps the pill across the strip and overshoots by up to ~100 px | rule only (no step touches the pill) |
| 2 | HIGH | src/ui/chrome.rs:891 (suggestion_popup → menus::floating), src/ui/menus.rs:164 (menu_item selected) |
Address suggestions grow from 0.9 scale + fade on open and fade out on close; the arrow-key selected row fades its highlight in/out with EFFECT |
Suggestions open and close instantly; the keyboard-selected row highlight is instant (pointer hover keeps its tint fade) | Rule 1 lists "Ctrl+L focus" and "address-bar dropdown rows" as instant. Highest-frequency surface in the browser; motion here reads as lag while typing | rule only |
| 3 | HIGH | src/ui/chrome.rs:615, chrome.rs:74-81, src/ui/menus.rs:719, menus.rs:1087 |
Address-bar wave phase, download-ring spinner, download-row wave and media seek wave all read raw i.time: they keep moving (and repainting every frame) with Motion Off |
One helper theme::clock(ctx) -> Option<f32> (scaled time + request_repaint, None when Motion Off); with None the wave is drawn flat (phase 0) and the spinner as a still 270° arc; no repaint requested |
D-023: Motion Off = nothing moves. The tab cookie spinner already does this right (chrome.rs:290-297); copy it, DRY (5 uses) |
rule 7 only ("every new animation") — existing loops not listed |
| 4 | MEDIUM | src/ui/menus.rs:371 |
Page context menu uses a fixed id ("page-menu", tab_id) and is drawn only while open (dialogs.rs:373), so floating's shown flag stays true after it closes: only the first right-click in a tab animates; every later one pops in at full size. It also vanishes instantly |
Give each menu a fresh id (counter in ctx data, bumped when a Dialog::ContextMenu is first seen, like dialog-count in dialogs.rs:226); exit stays instant (a pick is a system response, snap) |
Inconsistent motion on a tens/day surface; looks broken the second time | step 3 says "context menu from the pointer" but not the stale-id bug |
| 5 | MEDIUM | src/ui/pages/settings.rs:152, src/ui/pages/customize.rs:50, src/ui/pages/newtab.rs:110, src/ui/chrome.rs:181 (slide), src/ui/menus.rs:133 (flyout grow) |
Spatial UI motion on DEFAULT (ζ 0.68): settings rail pill overshoots up to ~23 px, customize side sheet overshoots ~20 px past its edge, NTP column bounces, tabs bounce when a neighbour closes, flyouts overshoot scale 1.005 |
Add MOVE = Spring { stiffness: 550.0, damping: 1.0 } (critically damped, ~250 ms) for on-screen movement and use EFFECT for flyout grow; keep DEFAULT only for drag release (chrome.rs:203-212 path) and rare delight (welcome) |
Rule 5: no overshoot on menus/flyouts/dialogs; movement critically damped. Bounce stays for "things the user drags and lets go" | step 1 adds critically damped presets but does not map call sites |
| 6 | MEDIUM | src/ui/mod.rs:303-331 |
Toasts appear and disappear in one frame, stacked in one Area; when one expires the others jump down; egui default frame and buttons |
Each toast rises 16 px + fades in (EFFECT), leaves by fading + 8 px down, the rest slide to their new place (MOVE), retargeting on rapid toasts; needs a toast id |
Prevents a jarring change on a tens/day surface; interruptible by construction with springs | yes (S039 step 4); styling → S043 |
| 7 | MEDIUM | src/ui/menus.rs:1086-1091 |
Media flyout seek wave moves its phase from i.time but repaints only every 500 ms when the visualizer is off → the wave jumps at 2 fps |
Use theme::clock (finding 3): per-frame while the flyout is open and playing; flat with Motion Off |
A visibly stepping animation is worse than none; the flyout is open rarely so per-frame cost is fine | no |
| 8 | MEDIUM | src/ui/dialogs.rs:17-46 |
Dialog enters (scrim + card rise 16 px, EFFECT) but on answer the scrim and card vanish in one frame |
Keep the scrim fading out after the dialog closes (EFFECT, scrim needs no body); the card itself may snap |
Exit mirrors entry for the part that covers the whole page; a 32 % dim popping off is the jarring bit | yes (S039 step 4, rule 6) — make the scrim-only exit explicit |
| 9 | MEDIUM | src/theme.rs:511 |
Springs settle at |Δ| < 1e-3 and |v| < 1e-2 in the value's own units. On pixel values (tab x, rail pill y, NTP top, backdrop x/y, welcome height) that is 1/1000 px: ~35-50 % more repainted frames after the motion is visually done | spring_px(ctx, id, target, spring) = same spring with settle at 0.05 px / 0.5 px/s; use it at the pixel call sites |
Rule 9: repaint only while something visibly moves; every extra frame reruns the whole chrome on the main thread WebKit's UI process shares | no |
| 10 | LOW | src/ui/menus.rs:146-152 |
Flyouts start at scale 0.9; origin = pivot.pos_in_rect(rect) of the constrained rect, so a menu pushed in from a screen edge scales from its own corner, not the pointer/anchor. Doc comment says "a little in width, more in height" but scaling is uniform |
Start at 0.95; origin = pos.clamp(rect.min, rect.max) (equals today's origin when not constrained); fix the comment |
Rule 4: 0.95-0.97 entry; scale from the anchor | step 3 partly (0.95) |
| 11 | LOW | src/ui/chrome.rs:496 |
Download ring progress uses DEFAULT → the ring can run ahead of the real fraction |
EFFECT like the address-bar progress (chrome.rs:591) |
Progress must never show more than is done; cohesion | no |
| 12 | LOW | src/ui/menus.rs:202, chrome.rs:1001, widgets.rs:1101 |
Submenus, bookmark-bar folders and dropdowns use egui::Popup::menu: egui's 100 ms fade only, no anchor scale, no exit |
Bookmark-bar folders and the widgets.rs dropdown → menus::floating (anchor scale); hover-opened submenus keep the plain fade |
Cohesion with flyouts; submenus are hover-frequent so fade-only is right there | S043 step 4 area, not explicit |
| 13 | LOW | src/ui/mod.rs:298 |
egui::Spinner (loading placeholder) spins with Motion Off |
Use chrome::spinner after finding 3 (static arc when Off) |
Motion Off rule | no |
Cleared (checked, correct as is)
- Tab drag: dragged tab follows the pointer via
spring_jump, others shift, release springs with bounce (chrome.rs:194-212): bounce is allowed here. - Window resize jumps instead of sliding (
chrome.rs:177-181); flyout switch closes the old one while the new one opens; reopening a closing flyout retargets (menus.rs:494-514). - Find bar (Ctrl+F) and permission/prompt bars appear instantly (
dialogs.rs:96,171): correct; animating their height would resize the WebKit view every frame — never do that. - Switch thumb
FASTovershoot (~1.6 px) and press squeeze: small control, M3 Expressive, keep. - New-tab backdrops honour Motion and
perf::still(backdrop.rs:110,139); album art spin honoursstill(menus.rs:989); tab cookie spinner honours Motion Off. - Address-bar wave replacing the URL during loads is the settled design (DESIGN.md
wavy_progress); only its Motion Off bug (finding 3) is a finding. - Welcome page motion (rare tier, delight allowed).
Missed opportunities (additive)
- Tab close: the closed tab disappears in one frame and the gap fills; a 120 ms fade + width shrink of the leaving tab (paint only,
EFFECT) would explain where it went. Pointer close only; Ctrl+W stays instant. Not in S039. - Badges (
chrome.rs:84,472,504): a download count / ad-block dot appearing could scale 0.6 → 1 + fade (EFFECT). The ad-block number changes many times per load: never animate the digits. Not in S039. - Settings section switch: instant today; S039 step 5 already plans the crossfade + 8 px shift.
- Download finished tick (rare tier delight): S039 rule 1 / step 6 already list it.
Out of scope noticed
egui_area.rs:128-136: whileapp_busy()the area repaints the last frame and re-queues itself from an idle handler, a busy loop for as long as the app is busy. Not motion; worth a look in S052 (tuning).- GTK's
gtk-enable-animationsis not read; Motion defaults to Normal. Seeding Motion Off on first run when it is false would honour the system reduced-motion switch (user's call, so not planned here).
3. Implementation steps
Self-contained; each block names files, current code and target values. All values at Motion Normal; everything
goes through theme::* so Fast/Slow/Off apply for free. Run nothing while another cargo build runs (CLAUDE.md §4).
Block A — add to S039 step 1 (presets and helpers, src/theme.rs)
- Under
EFFECT(theme.rs:434) add:/// Moving on screen (selection pills, sliding sheets, tabs making room): critically damped, about 250 ms. pub const MOVE: Spring = Spring { stiffness: 550.0, damping: 1.0 }; - Split the settle threshold: rename the body of
springtofn spring_eps(ctx, id, target, spring, eps: f32)and makespring_steptakeeps: settle when(s.value - target).abs() < eps && s.velocity.abs() < eps * 10.0.pub fn spring(..)calls it with1e-3(unchanged behaviour); add/// `spring` for pixel values: settles at 0.05 px, so it stops repainting once the motion is visually done. pub fn spring_px(ctx: &Context, id: Id, target: f32, spring: Spring) -> f32 { spring_eps(ctx, id, target, spring, 0.05) } - Add the loop clock (moves the pattern of
chrome.rs:290-297here):/// Time for looping decorations (spinners, waves), scaled by the Motion setting, asking for the next frame. /// None with Motion off: draw the still form and don't repaint. pub fn clock(ctx: &Context) -> Option<f32> { let motion = tokens(ctx).motion; (motion > 0.0).then(|| { ctx.request_repaint(); ctx.input(|i| i.time) as f32 / motion }) } - Tests next to the existing spring tests (
widgets.rs:911shows the harness):MOVEfrom 0 → 1 never exceeds 1.0 and is within 0.02 of 1 after 0.26 s of 1/60 s steps;spring_pxfrom 0 → 300 settles (returns exactly 300, no repaint requested) in fewer frames thanspringwith the same preset;clockreturnsNonewhenTokens.motion == 0.
Block B — add to S039 step 2 (remove motion that fails the frequency gate)
- Tab switch instant (
chrome.rstabs_in, before line 216): readlast = ctx.data(|d| d.get_temp::<u64>(Id::new("tab-pill-active"))), store the active tab's id;let switched = last.is_some_and(|l| l != active_tab_id);. Passjump = resized || switched || dragged activeto bothslidecalls. Passswitchedintotab(..)and there, before line 273,if switched { theme::spring_jump(&ctx, Id::new(("tab-on", tab_id)), if active { 1.0 } else { 0.0 }); }. Changeslide(chrome.rs:181) totheme::spring_px(ctx, id, target, theme::MOVE). Check: Ctrl+Tab across 10 tabs → pill on the new tab in the next frame; closing the tab left of the active one → pill slides ~250 ms with no overshoot. - Address suggestions instant: give
menus::floatingananimate: boolparameter; when false, callspring_jump(grow, target)andspring_jump(alpha, target)before reading them, so it opens and closes in one frame (withopen == falseit returnsNoneat once).suggestion_popup(chrome.rs:891) passesfalse; flyouts and the page menu passtrue. - Keyboard row selection instant: in
menu_item(menus.rs:164) replacetheme::effect(ui.ctx(), response.id.with("selected"), selected)withif selected { 1.0 } else { 0.0 }(the parameter is documented as the keyboard choice; hover tint still fades throughinteraction). - Motion Off loops (uses Block A.3):
chrome.rs:615let phase = if wave_on { theme::clock(&ctx).map_or(0.0, |t| t * 5.0) } else { 0.0 };and drop the unconditionalctx.request_repaint()atchrome.rs:617(keep one only whilemorphis moving, whichspringalready requests).chrome.rs:74spinner:match theme::clock(ui.ctx())→Nonedraws the arc from-π/2with sweep0.75·τand returns; drop itsrequest_repaint.menus.rs:719phase = if running { theme::clock(ui.ctx()).map_or(0.0, |t| t * 4.0) } else { 0.0 }, dropmenus.rs:722repaint.menus.rs:1087the same with* 4.0, and delete the 500 msrequest_repaint_after(menus.rs:1090) (fixes the 2 fps wave).chrome.rs:290-297: replace the inline clock withtheme::clock.mod.rs:298: replaceegui::Spinnerwithchrome::spinner(make itpub(super)). Check withmotion= Off: nacre.log/perfrenderscount stays flat on a loading page after the morph settles.
Block C — add to S039 step 3 (flyouts, menus)
menus.rs:133: grow usestheme::EFFECTboth ways (no overshoot).menus.rs:150:let s = 0.95 + 0.05 * grow;.menus.rs:148:let origin = pos.clamp(rect.min, rect.max);(passposthrough; it is the anchor point). Fix the comment atmenus.rs:146("grows uniformly from the anchor").- Page menu fresh id: in
page_dialogs(dialogs.rs:218+) theDialog::ContextMenuarm passescount; inpage_menuuseId::new(("page-menu", tab_id, count)). Confirmdialog-countis bumped when a dialog ends (grepdialog-count); if not, bump it whereresultis applied. Exit stays instant. - (LOW) Bookmark-bar folder popups (
chrome.rs:1001) and the dropdown inwidgets.rs:1101move tomenus::floatingwith the button rect's bottom-left/right as anchor; submenus (menus.rs:202) stayPopup.
Block D — add to S039 step 4 (dialogs, toasts)
- Dialog scrim exit: in
dialog_cardstorectx.data_mut(|d| d.insert_temp(Id::new("dialog-scrim"), page))each frame it draws. Inpage_dialogs, when no dialog is shown this frame butdialog-scrimexists, paint the scrim witha = theme::effect(ctx, Id::new("dialog-scrim-a"), false)atp.scrim.gamma_multiply(0.32 * a)on the sameOrder::Middlelayer; remove the key oncea < 0.01. While a dialog shows, drive the same effect id withtrue(so a new dialog during the fade retargets instead of restarting). - Toasts (
mod.rs:303-331,app.rs:151,189-195,1056-1058): addid: u64(a counter onShared) toToast. Intoasts, keepVec<(u64, String)>of toasts drawn last frame in ctx temp data; any id gone fromshared.toastsbecomes "leaving" and keeps drawing (no input) until its alpha < 0.01. Each toast is its ownArea(Id::new(("toast", id)),Order::Tooltip, anchorCENTER_BOTTOM) aty = -16 - spring_px(("toast-y", id), height_of_toasts_below, MOVE) + 16·(1 - enter) + 8·leave, opacityeffect(("toast-in", id), !leaving); heights measured from last frame's rects. First frame of a toast:spring_jumpits enter to 0 so it rises. Styling (tokens, M3 snackbar) belongs to S043.
Block E — add to S039 step 6/7 (movement presets at the remaining call sites)
settings.rs:152→spring_px(.., MOVE);customize.rs:50→spring(.., MOVE);newtab.rs:110→spring_px(.., MOVE);backdrop.rs:103→spring_px(.., DEFAULT)(pointer follow, keep its feel);welcome.rs:55→spring_px(.., DEFAULT)(rare tier, bounce allowed);chrome.rs:496→EFFECT.- Missed opportunity (optional, S039 step 6 or S043): pointer tab close fades and shrinks the leaving tab
(
EFFECT, ~120 ms, paint only); badge appear 0.6 → 1 + fade (EFFECT), digits never animate.
Block F — S043 notes
- S043 step 5 ("check S039 motion still applies") should also check: flyouts built from the new section cards keep
floating's anchor scale; new chips/meters useeffectfor colour andMOVEfor any fill movement; stat numbers (ad-block count) do not animate.
Verification (for whoever runs these)
tests/smoke/motion.txt(S039 creates it): mid-motion shots of tab close, flyout open, toast stack, dialog scrim exit; and with Motion Off a loading page and a running download: two shots 500 ms apart must be identical.- Feel-check with Motion = Slow (1.8×): pill and sheet must stop dead at their target (no back-swing); flyouts grow from the button/pointer even near the screen edge; Ctrl+Tab and arrow keys in the dropdown show no fade.
- Perf: compare
renders/ frame counts for a 10-tab close sequence before/after Block A.2 (expect fewer frames).
4. Coverage by S039 / S043
- Covered by a step: toasts (6), dialog exit (8, partly), flyout entry 0.95 (10, partly), settings crossfade, list stagger, caret.
- Rule only, no step applies it: tab switch instant (1), address dropdown instant (2), Motion Off for existing loops (3), critically damped presets mapped to call sites (5).
- Not covered: page-menu stale id (4), 2 fps seek wave (7), pixel settle threshold (9), progress ring overshoot (11), egui spinner (13).