Skip to content

fix(svg): reject draw: true when nothing drives draw_progress - #413

Merged
LeadcodeDev merged 1 commit into
mainfrom
fix/svg-draw-needs-a-driver
Sep 29, 2026
Merged

LeadcodeDev merged 1 commit into
mainfrom
fix/svg-draw-needs-a-driver

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

Closes #318.

The premise, verified

Two stills of the same mark, one with draw: true and one without, come back
byte-identical (cmp on the PNGs). The flag changes nothing:

let draw_active = self.draw || (props.draw_progress >= 0.0 && props.draw_progress < 1.0) || ...;
if draw_active {
    let progress = if props.draw_progress >= 0.0 { props.draw_progress } else { 1.0 };
    ...
    if progress >= 1.0 { self.paint_resvg(...); }   // the same call paint_static makes

With nothing driving it, draw_progress sits at its resting sentinel, progress
resolves to 1.0, and the >= 1.0 arm delegates straight to resvg.

Two documents said otherwise

  • The field's doc comment: "Force draw-on mode even when draw_progress is 1.0
    (static draw trace view, no animation needed)."
    There is no trace at progress
    1.0, only the finished render.
  • rules/draw-progress-stroke.md listed draw: true as a way to reveal a stroke
    progressively.

Both corrected. The doc comment is schemars-visible, so it is interface text and
stays — it now says what the flag actually does and that it needs a driver.

Why reject rather than reinterpret

The issue offered two readings. Treating an undriven draw as progress 0 makes
the mark vanish — a different surprise, not an answer. Rejecting it names the
problem where the author can act on it, which is the discipline this audit keeps
arriving at.

views[0].scenes[0].children[0]: draw: true but nothing animates draw_progress —
the mark renders finished, pixel-identical to draw: false. Add a 'draw_in' or
'stroke_reveal' preset, or keyframes on 'draw_progress'.

A driver is a draw_in/stroke_reveal preset, keyframes on draw_progress or
draw_start, or a wiggle on either.

Worth knowing

draw: true is not needed even with a driver: the painter switches as soon as
draw_progress is inside [0, 1). The flag only widens that window, so it is
never the thing that makes a stroke animate. The rule file now says so.

Tests

draw_with_nothing_driving_progress_is_pixel_identical_to_no_draw pins the
symptom itself, next to six validator tests covering each driver and each
non-driver.

Gate

cargo fmt --all --check clean · cargo clippy --workspace --all-targets --features rustmotion/studio -D warnings clean · cargo test --workspace 1778 passed.

An svg with draw: true and no driver renders the finished mark. Two
PNGs, one with the flag and one without, come back byte-identical:
draw_active takes the draw branch, draw_progress sits at its resting
sentinel, progress resolves to 1.0, and the >= 1.0 arm delegates
straight to resvg -- the same call paint_static makes.

The field's own doc comment claimed this was a feature, "static draw
trace view, no animation needed". It is not: there is no trace at
progress 1.0, only the finished render. The rule file repeated the
claim, listing draw: true as a way to reveal a stroke progressively.
Both are corrected.

Rejecting it at validation rather than reinterpreting it as progress 0:
a silently-ignored flag is the failure mode this audit keeps finding,
and progress 0 would make the mark vanish, which is a different surprise
rather than an answer. The error names the three drivers that work.

draw: true is not needed even with a driver -- the painter switches as
soon as draw_progress is inside [0, 1). The flag only widens that window,
so it is never the thing that makes a stroke animate.
@LeadcodeDev LeadcodeDev added the bug Something isn't working label Sep 29, 2026
@LeadcodeDev LeadcodeDev self-assigned this Sep 29, 2026
@LeadcodeDev
LeadcodeDev merged commit 94b38d8 into main Sep 29, 2026
4 checks passed
@LeadcodeDev
LeadcodeDev deleted the fix/svg-draw-needs-a-driver branch September 29, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

svg draw: true renders the mark filled when nothing animates draw_progress

1 participant