This Motoko library generates SVGs (as defined by the Scalable Vector Graphics 1.1 Specification)
import SVG "mo:svg/SVG";
let width : Int = 1200;
let height : Int = 400;
let canvas = SVG.SVG();
canvas.start(width, height, []);
canvas.circle(
600, 200, 100,
["fill=\"red\"", "stroke=\"blue\"", "stroke-width=\"10\""],
);
let svg = canvas.end();
More examples can be found here.
- circle
- ellipse
- polygon
- polyline
- rect (including roundrects)
- line
- text
- general
- arc
- cubic and quadratic bezier paths
- image
- linearGradient
- radialGradient
- pattern
- translate
- rotate
- scale
- skewX
- skewY
- ...
- ...
- desc
- defs
- g (style, transform, id)
- marker
- ...