Files
qbz/crates/qbz-ui/ui/primitives/LoadingDots.slint
T
vicrodh d9b82e7b12 perf: reduce-motion on the GL/software renderer tiers
On weak GPUs every animation frame is a full-window femtovg repaint, so
continuously-animated loading indicators dominate transient CPU (opening
the search cortinilla spiked to ~40% on a 2014 Mac Mini). New
ShellState.reduce-motion (seeded true on non-wgpu tiers, like the shader
gate) switches those animations from display-rate animation-tick to a
shared ~8fps coarse clock advanced by ONE timer in AppShell — same phase
math, 60 -> 8 repaints per second:

- LoadingSpinner / LoadingDots (all mount sites inherit)
- Equalizer bars (TrackPlayCell + immersive track info)
- Fetch/download spinners (TrackPlayCell x2, TrackRow, offline manager)
- Both search-cortinilla skeleton pulses (the reported spike)
- Home skeleton: the 900ms opacity fade collapses to a snap (its phase
  timer becomes the only driver, ~1fps while mounted)

Also logs the window scale factor at startup (circle-AA investigation:
femtovg's fringe AA halves at fractional scale factors, dpi=ceil(scale)).

cc
2026-07-01 20:55:09 -06:00

44 lines
1.4 KiB
Plaintext

// Loading indicator — three pulsing dots above an optional label. A
// lightweight replacement for empty-color placeholders during heavy
// loads (search, large grids, the playlist manager, etc.).
import { Theme } from "../foundation/semantic-colors.slint";
import { ShellState } from "../state.slint";
component Dot inherits Rectangle {
in property <float> delay; // 0..1 phase offset
width: 8px;
height: 8px;
border-radius: 4px;
background: Theme.text-secondary;
// Reduce-motion: ~8fps coarse clock instead of display-rate repaints.
property <float> anim-ms: ShellState.reduce-motion
? ShellState.coarse-tick-ms * 1.0
: animation-tick() / 1ms;
property <float> phase: Math.mod(root.anim-ms / 900.0 + root.delay, 1.0);
property <float> tri: 1.0 - Math.abs(root.phase - 0.5) * 2.0;
opacity: 0.25 + 0.55 * tri;
}
export component LoadingDots inherits Rectangle {
in property <string> label;
VerticalLayout {
alignment: center;
spacing: 12px;
HorizontalLayout {
alignment: center;
spacing: 8px;
Dot { delay: 0.0; }
Dot { delay: 0.18; }
Dot { delay: 0.36; }
}
if root.label != "": Text {
text: root.label;
color: Theme.text-muted;
font-size: 13px;
horizontal-alignment: center;
}
}
}