This API is experimental
Its behavior may change in a future version of p5.js.
Records drawing commands executed inside callback into a p5.ShapeCollection and returns it.
buildShape is the easiest way to record a self-contained drawing block. It intercepts p5.js drawing commands within the callback and stores them. begin() and end() are called automatically.
Options:
draw(Boolean, optional): Iftrue, the drawing commands will be drawn onto the canvas in addition to being recorded. Iffalse(default), they are only recorded silently without rendering.
Examples
Syntax
buildShape(callback, [options])
Parameters
callback
Function: a function containing the drawing instructions.
options
Object: recording options.
Returns
p5.ShapeCollection: the recorded shape.
Notice any errors or typos? Please let us know. Please feel free to edit src/shape/svg/svg_export.js and open a pull request!