Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including normalize-svg-path with all npm packages installed. Try it out:

var normalizeSvgPath = require("normalize-svg-path")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

normalize-svg-path v1.0.1

Convert all segments in a path to curves

normalize-svg-path build

Convert all segments in a path to curves. Usefull if you intend to animate one shape to another. By defining all segments with curves instead of a mix of lines, arcs, and curves tweening becomes much simpler. It could also help you rewrite your SVG code according to the principles of narcissistic design.


npm install normalize-svg-path

var parse = require('parse-svg-path')
var abs = require('abs-svg-path')
var normalize = require('normalize-svg-path')

var segments = normalize(abs(parse('M0 0L10 10A10 10 0 0 0 20 20Z')))



Translate each segment in path to an equivalent cubic bézier curve. The input path must be absolute.

normalize([['L',1,2]]) // => [['C',0,0,1,2,1,2]]


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free