Answer the question
In order to leave comments, you need to log in
How to turn svg file into an array of coordinates and vice versa?
I need to turn the properties from patch into an array of data that stores the position of each point in X and Y, as well as the slope and sharpness of the angle.
But I don't understand the svg file syntax
<path class="path_1" d="M366.5,74.5c1.19,58.5-.19,314.24-.19,314.24V678.5H987V74H670.89Z" transform="translate(-365.81 -73.5)"/>
<path class="path_2" d="M366.5,74.5c43,68,289,295,289,295l-289.19,309,317.19-279L987,678.5l-270.5-308L987,74,682.5,335.5Z" transform="translate(-364.4 -72.12)"/>
<path class="path_3" d="M1037.5,403.5c-79.07-14.86-332-37-332-37l-35-359-16,358-352,28,351.21,15.83L682.5,751.5l20-343.21Z" transform="translate(-302.46 -7.45)"/>
var path = [x, y, corner_1, corner_2]
Answer the question
In order to leave comments, you need to log in
Chrome removed path.pathSegList , which was excluded from the new SVG standard , but did not add path.getPathData() - an alternative offered by this standard. Genius move, I must say.
So the options are:
1. use a polyfill for pathSegList - so at least in fox it will work natively (for the time being).
2. use a polyfill for getPathData() - so someday it will work natively everywhere (so far - nowhere).
3. use a general-purpose svg-libu thread - so the lib will think for you, and you will have a hundred or two kilos of garbage code in your project.
4. write an owl bicycle - this way you will have a piece of code that suits you, and don’t care about nativeness, we don’t turn tea in thousands of ways.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question