translate-svg-path
v0.0.1
Published
Translates the position of an SVG path against its X/Y coordinates.
Downloads
1,239
Readme
translate-svg-path
translate-svg-path translates the position of a parsed SVG path against its X/Y coordinates. It was extracted from Fontello’s wonderful svgpath toolkit.
Older browsers might require a polyfill for Array.prototype.map.
Install
$ npm install translate-svg-path
API
translate(path, x [, y])
Example
var parse = require('parse-svg-path')
var translate = require('translate-svg-path')
var serialize = require('serialize-svg-path')
var path = parse('M10 10 L15 15')
var x = translate(path, 20)
var xy = translate(path, 20, 10)
serialize(x)
// => 'M30 10 L35 15'
serialize(xy)
// => 'M30 20 L35 25'