Reference getSVG()

getSVG()

This API is experimental

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

Returns a valid SVG 2.0 XML string from a p5.ShapeCollection.

Useful for injecting SVG markup into the DOM or sending it to a server. To download a file directly, use saveSVG() instead.

Examples

Syntax

getSVG(record)

Parameters

record
p5.ShapeCollection: the recorded shape to serialize.

Returns

String: the SVG XML string.

Related References