The internal format of parametric.svg
This repo describes the structure of objects that different parts of parametric.svg use to communicate with each other. Here’s some reasoning behind the idea.
npm install parametric-svg-ast
const ast = require('parametric-svg-ast');
const myAst = ast({
attributes: [
{
address: [2, 5, 4],
name: 'width',
dependencies: ['a', 'b'],
relation: (a, b) => a + b,
},
{
address: [4, 8],
name: 'height',
dependencies: [],
relation: () => 59,
},
],
defaults: [
{
identifier: 'a',
dependencies: [],
relation: () => 10,
},
{
identifier: 'b',
dependencies: [],
relation: () => 20,
},
]
});
//» { type: 'ParametricSvgAst',
// version: 1,
// attributes: [object Set],
// defaults: [object Set] }
See the API docs in the source. If you can help us render them in the readme, that would be awesome!