I am developing a drawing app, and now I want to add a function which creates SVG from my canvas or control points. (I save the mouse coordinates for each drawing step).
canvasElement.toDataURL("image/svg+xml"); // -- doesn't work
One condition – don’t use external libs.
I understand, that it is possible to generate an SVG file in Javascript like:
var mysvg = "<svg>"; for(something) { mysvg += "something"; } //etc
But I don’t think that it is good way.
Can you advise anything?
I solved the problem by generating SVG file. I translated all my canvas drawing functions into SVG drawing tags.
Something like that:
So, in svg variable there will be SVG file generated from Canvas.
Thanks everybody!