svg-component

low-level svg component

svg

low-level svg helper

$ component install matthewmueller/svg
var graph = document.getElementById('graph');
var svg = require('svg');
var element = svg(graph);
 
var box = element('rect')
  .size(100)
  .attr('fill', 'black')
  .rotate(20)
  .move(50);

Initialize an svg document and attach it to parent. Returns an Element.

Initialize Element.

Get and set attributes

Set the width and height

Perform a transform on the element. Options include: rotate, scale, skewX, skewY, translate, transform.

Move

Rotate the element

Scale the element

  • move(), size() should also work with circle, ellipsis, etc.

MIT