Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any online tools to test SVG paths?

Tags:

debugging

svg

I'm building an application that uses SVG paths, and I'd like to be able to see my paths rendered. Is there a site, say something like JSFiddle, on which you can paste in an SVG path, get it validated, and see it rendered?

EDIT: I've found that JSFiddle works fairly well for this, by selecting Raphael.js, svg.js, etc as a framework. e.g. http://jsfiddle.net/DFhUF/1393/

var paper = Raphael(0, 0, 300, 500);  paper.path("M75,75 m-50,0 a50,50 0 1,0 100,0 a50,50 0 1,0 -100,0") .attr({stroke: "#808", opacity: 1, "stroke-width" : 6})  paper.path("M75,225 m-40,-50 h80, a10,10 0 0,1 10,10 v80 a10,10 0 0,1 -10,10 h-80 a10,10 0 0,1 -10,-10 v-80 a10,10 0 0,1 10,-10") .attr({stroke: "#808", opacity: 1, "stroke-width" : 6}) 

That's probably good enough for my needs, but it would be nice to know if there are other tools to help test and debug editing of SVG Paths.

like image 285
ericsoco Avatar asked Jul 05 '13 23:07

ericsoco


People also ask

How do I test an SVG file?

All modern web browsers support viewing SVG files. That includes Chrome, Edge, Firefox, and Safari. So if you have an SVG and can't open it with anything else, open your favorite browser, select File > Open, then choose the SVG file you'd like to see. It will appear in your browser window.

How do I preview an SVG code?

Preview. This extension also provides a “Preview” function that shows a side-by-side preview with the markup and the rendered image. This is available from the Command Pallet (Ctrl/Cmd + Shift + P). The cool thing about this is that the preview updates live as you type your SVG.


1 Answers

If you just want to quickly try out some SVG in your browser and not mess around with saving and loading files, jsFiddle is a great option.

Just use the following code as a template:

<svg xmlns="http://www.w3.org/2000/svg">     <path d="your path data here"></path> </svg> 

I created a sample to work from here.

jsFiddle also supports frameworks such as D3, PaperJs and Raphael from a dropdown on the left-hand side.

like image 79
Drew Noakes Avatar answered Sep 20 '22 01:09

Drew Noakes