Reference createSVG()

createSVG()

This API is experimental

Its behavior may change in a future version of p5.js.

Parses an SVG string or DOM element synchronously and returns a p5.ShapeCollection.

Use this when SVG content is already available in memory. To load from a file or URL, use loadSVG() instead.

Examples

Syntax

createSVG(svgSource)

Parameters

svgSource
String|SVGElement: a raw SVG string or an SVG DOM element.

Returns

p5.ShapeCollection: the parsed shape.

Related References