parametric-svg

Parametric 2D graphics in the browser. With pure SVG.

Usage no npm install needed!

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

README

Travis CICode climateDavid DM

parametric.svg

Parametric 2D graphics in the browser. With pure SVG.

Heads up! This package is in an early development stage. Not ready for use yet.

Installation

$ npm install parametric-svg

API

parametricSVG(svgRoot, [parameters])

Parse and render all elements within the svgRoot. Defaults set with &lt;ref&gt; elements will be used for calculation, unless you override them with parameters.

Parameters

parameter type description
svgRoot SVGSVGElement An &lt;svg&gt; element.
[parameters] Object optional: A hash of additional parameters. They&#39;ll extend and override defaults set with &lt;ref&gt; elements.

Returns VirtualTree, A cached virtual DOM tree for lightning-fast redraws.

parametricSVG(element, parameters)

Pass any SVG node (like &lt;circle&gt;) to parse and render the node and all its descendants.

Parameters

parameter type description
element SVGElement
parameters Object A hash of parameters.

Returns VirtualTree, A cached virtual DOM tree for lightning-fast redraws.

parametricSVG(virtualTree, [parameters])

Pass a cached VirtualTree to render the tree without reparsing any DOM. This is the fastest option.

Parameters

parameter type description
virtualTree VirtualTree
[parameters] Object optional: Supply a hash of additional parameters. They&#39;ll extend and replace cached ones.

Returns VirtualTree, A cached virtual DOM tree for lightning-fast redraws.

undefined

License

MIT © Tomek Wiszniewski.