Skip to content

Instantly share code, notes, and snippets.

View henryluki's full-sized avatar

Yangling Xie henryluki

View GitHub Profile
@shamansir
shamansir / draw_svg.js
Last active February 20, 2023 16:11
draw SVG path on canvas
// take SVG commands and draw this path to HTML5 canvas
// commandList should look like that: [ { marker: "M", values: [ 10, 10 ] },
// { marker: "l", values: [ 5, 7 ] },
// { marker: "C", values: [ -5, 7.2, .3, -16, 24, 10 ] },
// . . .
// { marker: "z", values: [ ] } ]
// there's another gist which has the code to parse SVG paths:
// https://gist.github.com/shamansir/0ba30dc262d54d04cd7f79e03b281505