Loading...
Loading...
Vẽ dần nét SVG (stroke-draw) theo cuộn trang hoặc khi vào viewport — đo `path.getTotalLength()`, set `stroke-dasharray`/`stroke-dashoffset`, animate dashoffset từ length về 0. Gọi khi user nói "vẽ svg khi cuộn", "svg stroke draw", "logo vẽ dần", "path animation reveal", "stroke-dashoffset", hoặc /svg-stroke-reveal. KHÁC `skills/scroll-effects` (7 hiệu ứng cuộn chung — reveal/stagger/highlight/nav/top/toc/parallax, KHÔNG có stroke-draw) — skill này chuyên biệt cho SVG `<path>` có NÉT VẼ (logo, chữ ký, biểu đồ đường, hành trình).
npx skill4agent add rheinmir/setup svg-stroke-reveal<path><path>Rheinmir/uiux-assetskills/scroll-effects<text>[data-svgr] > <path>×N → getTotalLength() → dasharray = dashoffset = length (ẩn) → mode "once" (IO một lần + CSS transition) hoặc mode "scroll" (IO bật cờ + 1 listener rAF ghi dashoffset theo progress) → reduce-motion: dashoffset = 0 ngay| Field | Required? | Ý nghĩa | |
|---|---|---|---|
| In | SVG thật của dự án (các | có | |
| In | mode | có | logo/chữ ký → once; biểu đồ/hành trình → scroll |
| In | | không | có thì đổi token màu theo nó |
| Out | SVG gắn | có | copy nguyên file gốc hoặc adapt |
| Out | bằng chứng verify | có | ảnh trước/giữa/sau (scroll) + once chỉ trigger 1 lần |
getTotalLength()transform: scale(sx, sy)sx != syviewBoxwidthheight<text><path>[data-svgr]<text><text>getTotalLength()IntersectionObserverscrollplaywright-verifydesign.md<text><path>viewBoxwidthheight| Step | Type | Inputs | Action | Outputs/exit | Failure/next |
|---|---|---|---|---|---|
| W01 | judgment | SVG + yêu cầu | Chọn mode | mode | |
| W02 | effect | bảng Pen gốc | Mở link chạy, copy nguyên file | file gốc trong dự án | không được kéo lib ngoài → B01 |
| W03 | effect | file + SVG thật + | Chỉ sửa nội dung/ảnh/màu (thay path | SVG đã adapt | — |
| W04 | deterministic | trang chạy qua HTTP | Verify bằng | ảnh + assert | đỏ → sửa, lặp W04 |
| ID | Kind | Guard | Hành vi | Skip / failure | Rejoin |
|---|---|---|---|---|---|
| B01 | conditional_required | dự án KHÔNG được kéo lib ngoài (bản gốc) | dùng bản rút gọn vanilla | — | W04 |
| B02 | conditional_required | | | — | W04 |
data-svgr="once"<text>getTotalLength()<path>[data-svgr]Rheinmir/uiux-asset.html_assets/file://git clone --depth 1 https://github.com/Rheinmir/uiux-asset| Pen gốc — tác giả | Link |
|---|---|
| Interactive Cicada Genomics Landing Page — alyona-mysiura | chạy · code |
| Scroll-Driven SVG Map Editorial Gallery — knyttneve | chạy · code |
| Scroll-Driven Godzilla Walk-and-Destroy Animation — creativeocean | chạy · code |
assets/assets/demo.htmlassets/svg-stroke-reveal.cssassets/svg-stroke-reveal.jsd=design.md<path>[data-svgr]path.getTotalLength()style.strokeDasharray = lengthstyle.strokeDashoffset = lengthdata-svgr="once"IntersectionObserverstrokeDashoffset = 0transition: stroke-dashoffsetunobservedata-svgr="scroll"IntersectionObserverprogress = (innerHeight - rect.top) / (innerHeight + rect.height)strokeDashoffset = length * (1 - progress)<path>transition-delay: calc(var(--svgr-i) * 160ms)--svgr-iprefers-reduced-motion: reducestrokeDashoffset = 0