JSPM

normalize-svg-path

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1948186
  • Score
    100M100P100Q196084F
  • License MIT

convert all segments in a path to curves

Package Exports

  • normalize-svg-path

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (normalize-svg-path) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.

Usage

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')))

API

normalize(path)

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]]