Skip to content

feat(svg): progressive path draw-on animation#60

Merged
LeadcodeDev merged 1 commit into
mainfrom
feat/svg-draw-on
Jul 19, 2026
Merged

feat(svg): progressive path draw-on animation#60
LeadcodeDev merged 1 commit into
mainfrom
feat/svg-draw-on

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

Closes #48.

Goal: evolvePath-style draw-on for real SVGs — the svg component rasterized statically and draw_in only worked on shape/line/arrow/connector.

  • usvg tree walk → Skia paths (all verbs, absolute transforms applied point-by-point; tiny_skia was already a dependency)
  • Progress spreads sequentially by measured path length (draw_overlap: 0.0→1.0 interpolates toward all-parallel); partial paths use the same dash technique as line/connector
  • Fill-only paths trace their contour with a synthetic stroke (draw_stroke_width, default 2.0) — the classic logo-reveal look
  • draw_progress ≥ 1.0 falls through to the unchanged resvg rasterization (fills restored); static rendering byte-identical; three additive schema fields (draw, draw_stroke_width, draw_overlap)

Tests: 7 new pixel tests (zero at 0, first-path-only at 0.5, complete at 1.0, parallel with overlap, fill-only contour, static unchanged, draw without animation). 303 total, all green.

Verify: cargo test --workspace → 303 passed ✓ · cargo fmt --check ✓ · clippy 0 warnings ✓

draw_in/stroke_reveal now apply to the svg component: when
draw_progress is animating (or draw: true), the usvg tree is walked
and each path converted to Skia (move/line/quad/cubic/close with
absolute transforms) and traced progressively with the dash technique
shared with line/connector. Progress spreads sequentially across
paths by measured length; draw_overlap interpolates to parallel.
Fill-only paths trace their contour with draw_stroke_width. At
progress 1.0 the render falls through to the unchanged resvg
rasterization (fills restored); the static path stays byte-identical.
@LeadcodeDev
LeadcodeDev merged commit 264e875 into main Jul 19, 2026
@LeadcodeDev
LeadcodeDev deleted the feat/svg-draw-on branch July 19, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(svg): progressive path draw-on animation

1 participant