simplify-svg-path
Extracts Path#simplify()
from Paper.js.
http://paperjs.org/reference/path/#simplify
Installation & Usage
$ npm i @luncheon/simplify-svg-path
import simplifySvgPath from '@luncheon/simplify-svg-path'
const points = [[10, 10], [10, 20], [20, 20]];
const path = simplifySvgPath(points);
<script src="https://cdn.jsdelivr.net/npm/@luncheon/simplify-svg-path@0.2.0"></script>
<script>
const path = simplifySvgPath([[10, 10], [10, 20], [20, 20]]);
</script>
API
simplifySvgPath(
points: [x: number, y: number][],
{
tolerance: number = 2.5,
precision: number = 5,
} = {}
): string
Note
The logic is a copy of Paper.js v0.12.11.
If you like this, please send your thanks and the star to Paper.js.