peter.o
peter.o

Reputation: 3530

How to draw arc using svg.js

Using svg.js I would like to draw path with arc:

M75,0 L75,118.85 A30,30 0 0 0 640,660.15 L568.5690264688633,781.8607965826662 

I have tried everything (gaps, commas,...) but not success. Still getting error:

Error: Problem parsing d="M 50 0 L 50 108.8499984741211 A 660.3822631835938 199.75233459472656 L 631.133056640625 133.80345153808594"

Thanks a lot in advance.

Upvotes: 3

Views: 4417

Answers (1)

Nils
Nils

Reputation: 2071

There is a plugin https://github.com/otm/svg.path.js which provides a easier interface to create paths. With the plugin you can for instance write write:

var draw = SVG('drawing').size(800, 800);
var path draw.path().M(10, 10).L(20, 20)

Here are some examples for the plugin: http://otm.github.io/svg.path.js/

There is also a new feature in svg.js called path array:

https://github.com/wout/svg.js#svgpatharray

Upvotes: 4

Related Questions