Repository navigation
Description
What would you like to be added? 💡
Scroll motion on Skia is produced by six independent motion sources, none of which agree on a clock, and two of the input paths quantize motion before it reaches the visual.
Concretely:
- No frame clock. Nothing evaluates motion at the frame's presentation time. Ticks are not scheduled on a vsync, so a raw clock read wobbles by milliseconds around a cadence that is otherwise exact. For a driver whose position is a function of time, that wobble becomes
v·dtof position error — at scroll speeds, a visible fraction of a frame step. It gets worse as refresh rate rises, since the error staysv·dtwhile the step itself halves. - Touch drag is quantized to ≥2 logical px. The per-device manipulation delta threshold exists to bound the volume of public
ManipulationDeltaevents, but on the scroll path it acts as a motion quantizer: content does not move until 2 px have accumulated, then jumps by the whole amount. A slow drag therefore advances every other frame. (Inertia already bypasses this threshold for precisely this reason.) - Wheel deltas are floored to zero. A precision touchpad reports deltas finer than one 120-unit detent, and integer division discards every one of them.
- Wheel is a 1 s keyframe animation restarted per detent, each restart firing a non-intermediate
ViewChanged→InvalidateArrange, producing a per-detent hitch.
The result is that Win32-with-a-wheel is the only configuration in which scroll motion is a single time-parameterised function evaluated exactly once per frame, inside the frame it affects, with no quantizer between input and visual. Every other configuration adds at least one of: a 2-DIP quantizer, a full frame of latency, or no smoothing at all.
Why is this needed? 🤔
Scrolling is the most-used interaction in any list-based app, and it is where jank is most visible. The per-platform ordering users report (Desktop best → Android/iOS worse → mobile-browser WebAssembly worst) decomposes into a device axis and a platform axis that are currently conflated — fixing it requires a single clock discipline rather than per-platform tuning.
Worth stating explicitly, because it inverts the obvious assumption:
The physics model is not the FPS bottleneck. Per-frame render cost is, and clock discipline is second. Physics changes feel; it does not change FPS.
Renderer 🎨
- Skia
- Native
For which platforms 📱💻🖥️
All platforms 🌍 (Skia targets)
Anything else we need to know? 💬
Proposed invariants:
- I1 — Single frame timestamp. Exactly one timestamp is sampled per frame at
Render()entry, and every animation and simulation in that frame is evaluated at it. - I2 — Motion is a function of time, not of event arrival. Every scroll source (wheel, key, touch drag, touch inertia, programmatic) produces or updates a single closed-form
x(t)evaluated once per frame, before the picture is recorded. Impulses accumulate into the running simulation rather than restarting it.
Deliberately not adopted: pointer resampling as the headline fix (costs ~38 ms of added latency), pointer prediction/extrapolation (absent from dxaml; causes overshoot artifacts), and inventing an easing function for programmatic scroll (WinUI supplies none — doing so would be a silent parity deviation).
Depends on the O(1) scroll damage work tracked separately, which is the larger FPS lever.
Activity
[-]Scroll motion has no frame clock, and touch/wheel deltas are quantized[/-][+]😀 Scroll motion has no frame clock, and touch/wheel deltas are quantized[/+][-]😀 Scroll motion has no frame clock, and touch/wheel deltas are quantized[/-][+]Scroll motion has no frame clock, and touch/wheel deltas are quantized 🩵[/+]