Show:
API

Matter.Svg

Defined in: src/geometry/Svg.js:1

The Matter.Svg module contains methods for converting SVG images into an array of vector points.

To use this module you also need the SVGPathSeg polyfill: https://github.com/progers/pathseg

See the included usage examples.

Methods

Matter.Svg.pathToVertices

(path, [sampleLength=15])
Vector[]

Converts an SVG path into an array of vector points. If the input path forms a concave shape, you must decompose the result into convex parts before use. See Bodies.fromVertices which provides support for this. Note that this function is not guaranteed to support complex paths (such as those with holes). You must load the pathseg.js polyfill on newer browsers.

Parameters

Returns

Vector[]

points