@parametric-svg/ast

The internal format of parametric.svg

Usage no npm install needed!

<script type="module">
  import parametricSvgAst from 'https://cdn.skypack.dev/@parametric-svg/ast';
</script>

README

Code style: airbnb

parametric.svg AST

The internal format of parametric.svg

 

What’s up?

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.

 

Install

npm install parametric-svg-ast
 

Use

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] }
 

API

See the API docs in the source. If you can help us render them in the readme, that would be awesome!

 

License

MIT © Tomek Wiszniewski