Animate composer border at constant arc speed
Lay the running highlight out by rounded-border arc length so it advances at a steady linear speed without a loop jump, while preserving the existing colours and reduced-motion border. Add focused geometry tests and implementation notes.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# Composer running border: constant arc-length speed
|
||||
|
||||
## Change
|
||||
- The highlight is now laid along the pill's outline by arc length instead of a
|
||||
`SweepGradient` rotated by angle. Equal time steps move it equal distances
|
||||
round the rounded rectangle: no racing along long edges, no crawling at ends.
|
||||
- `lib/features/chat/conversation/composer_running_arc.dart` (new, pure helpers):
|
||||
origin = fractional lap × outline length; colour bands at the original stops
|
||||
(0, .12, .24, .38, 1) and colours; segments of ~3 px with a 0.5 px seam
|
||||
overlap, transparent pieces omitted; `runningArcPath` extracts a piece of the
|
||||
outline across contours.
|
||||
- `lib/features/chat/conversation/composer_running_border.dart`: the painter
|
||||
draws those segments with the same glow and line strokes. Reduced motion still
|
||||
paints the static border and never ticks. Period (2.75 s), colours, stroke width
|
||||
and linear lap curve are unchanged.
|
||||
|
||||
## Speed
|
||||
- `ComposerRunningBorder.period` is now 2750 ms (one lap per 2.75 s, the midpoint
|
||||
of the requested 2.5–3 s). It was 4 s; review rejected that as too slow.
|
||||
|
||||
## Focused results
|
||||
- `tool/memwatch/full.sh 'test/features/chat/conversation/composer_running_arc_test.dart test/features/chat/conversation/chat_composer_running_test.dart'`
|
||||
→ PASS 16 passed, 0 failed (peak ~977 MB, exit 0).
|
||||
- `tool/analyze.sh` on the three changed files → clean.
|
||||
- New tests (`test/features/chat/conversation/composer_running_arc_test.dart`):
|
||||
perimeter measured by arc; origin advances equal arc per equal lap step;
|
||||
origin and colours wrap (progress 1 == 0, f == f+1); colour shifts with
|
||||
arc under time; visible band spans 0.38 of the lap on a long pill and a
|
||||
square; segments are ordered and inside the outline; `runningArcPath`
|
||||
extracts the requested arc.
|
||||
- Existing widget tests in `chat_composer_running_test.dart` (border mount and
|
||||
unmount, reduced motion static, no ticks at rest, /stop, Escape handling)
|
||||
pass unchanged.
|
||||
|
||||
## Affected states (not captured)
|
||||
- Running composer border: default and reduced motion. Not captured or
|
||||
reviewed here (ui-review owns captures). Mobile and browser behaviour is
|
||||
unverified.
|
||||
|
||||
## Limitations
|
||||
- Each frame draws about 0.38 × perimeter / 3 px segments twice (blurred glow
|
||||
and line). Not profiled on device.
|
||||
- The time-to-lap mapping is `AnimationController`'s default linear curve; it is
|
||||
tested through the pure origin mapping, not by a widget test reading the
|
||||
controller.
|
||||
Reference in New Issue
Block a user