parametric-svg-patch
Update a parametric SVG element with new data. A low-level library.
➕
const parse = ;const patch = ;const rectangle = document;const ast = ; ;
➔
Installation
$ npm install parametric-svg-patch
Usage
patch(
element: DOMElement,
ast: ParametricSvgAst,
variables: Object
) => void
patch( element: DOMElement, ast: ParametricSvgAst, variables: Object ) => void
The element
will be updated in place with bindings from the ast
using
the variables
you give us. The ast
should generally come from the module
parametric-svg-parse. You can also generate it yourself using
parametric-svg-ast.
If a parametric attribute depends on a variable you don’t give us, we won’t
update the attribute. For example, if you have
a <rect parametric:x="a + 1" y="5" parametric:y="b + 1" />
and only
give us {a: 10}
as variables
, the result will be
<rect x="11" parametric:x="a + 1" y="5" parametric:y="b + 1" />
.