svg-elem
Generic animatable svg elements.
Examples
Installation
npm i svg-elem
Usage
const svg = parentDom: document tag: 'svg' attr: 'width': 500 'height': 500 style: 'background': '#eee' const circle = parentDom: svgelem tag: 'circle' attr: 'cx': 250 'cy': 250 'r': 50 style: 'fill': 'white' 'stroke': 'black' 'stroke-width': '2px'
Required Props
Props you must specify:
parentDom
- the DOM element that contains your elementtag
- element name of the SVG
Optional Props
Props you can optionally specify:
attr
- SVG element attributesstyle
- SVG element stylestext
- text content for svg texts
Methods
Methods you can specify:
setAttr(oParam, shouldAnimate)
- updates SVG's attributessetStyle(oParam, shouldAnimate)
- updates SVG's styles