translate-svg-path

Translates the position of an SVG path against its X/Y coordinates.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
translate-svg-path
400.0.110 years ago10 years agoMinified + gzip package size for translate-svg-path in KB

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.
Build status
Browser support
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'

License

MIT