https://github.com/dawee/svg-flat-document
Parse and manipulate to a flat SVG object
https://github.com/dawee/svg-flat-document
Last synced: 2 months ago
JSON representation
Parse and manipulate to a flat SVG object
- Host: GitHub
- URL: https://github.com/dawee/svg-flat-document
- Owner: dawee
- Created: 2016-06-02T16:14:15.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-19T19:16:08.000Z (about 10 years ago)
- Last Synced: 2025-10-23T18:42:12.635Z (9 months ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SVGFlatDocument
ES6 SVG document without tree (flat)
## Install
```
npm install svg-flat-document
```
## Usage
## Parse from SVG string
```js
import SVGFlatDocument from 'svg-flat-document';
let doc = SVGFlatDocument.parse(svgString);
```
*With svgString =*
```xml
```
## Retreive element
```js
let node = doc.mapping.me;
let attr = node.attributes;
console.log(attr.x, attr.y, attr.width, attr.height);
// 0 0 100 200
console.log(attr.transform);
// matrix(1,0,0,1,100,0)
```
So groups are ignored and children absorb every parents transforms.