Pave

A library for manipulating SVG/Path2D curves

npm version   npm license   CI test result

Pave is a environment-agnostic toolkit specialized for manipulating SVG/Path2D curves, which includes creating primitives, calculating positions/normals/tangents, offsetting, and resampling paths. All of the API are provided in a functional programming manner, and the path data is represented as an immutable plain object.

Currently, the library heavily depends on Bazier.jsopen in new window by Pomaxopen in new window and Paper.jsopen in new window by Jürg Lehni open in new window – or it might be said that this library is a thin wrapper for them to provide FP-oriented interfaces. Although I’m going to rewrite the whole library with zero dependencies for performance and file size, please consider sponsoring them if you think it’d be useful.

To try out the library, visit the Sandbox.

TIP

All code blocks with viewer on the right are editable so you can try out the Pave library right here in the documentation.

API

See the full documentation on API

  • Path: The core module for manipulating paths.
  • Comamnds
    • Arc: The arc (A) commands functions.
    • CubicBezier: The cubic Bezier © commands functions.
    • Line: The line-to (L) commands functions.
  • Geometries
    • Circle: The functions for handling circles.
    • Rect: The functions for handling rects.
  • Distort: The functions for handling distortions.
  • Type Aliases

Getting Started

See the Guide for more detailed information.