@pod-point/build-svg

1.2.0 • Public • Published

BuildSVG

Class that can define and manipulate SVG elements. Build up an image by creating children BuildSVG elements.

Import

import BuildSVG from '@pod-point/build-svg';

Use

Create a new element

var svg = new BuildSVG('svg', attrs);

svg.element; // SVGElement

Methods

.attr()

svg.attr('d'); // Get 'd'
svg.attr('d', 'M100 200'); // Set 'd'
svg.attr(attrs); // Set multiple

.dimensions()

svg.dimensions(width, height); // Set width and height

.offset()

svg.offset(); // Get { x, y }
svg.offset(x, y); // Set { x, y } 

.append()

svg.append(new BuildSVG('path')); // Adds a path tag after all children

.prepend()

svg.prepend(new BuildSVG('path')); // Adds a path tag before all children

.create()

svg.create('path', attr); // Create and append child SVG path

Readme

Keywords

none

Package Sidebar

Install

npm i @pod-point/build-svg

Weekly Downloads

188

Version

1.2.0

License

MIT

Last publish

Collaborators

  • pod-point