Rac. P5Drawer

Drawer that uses a P5 instance for all drawing operations.

Constructor

new P5Drawer()

Members

debugMarkerRadius :number

Radius of the main visual elements for debug drawing.

debugPointRadius :number

Radius of point markers for debug drawing.

debugStyle :object

Style used for debug drawing, when null the style already applied is used.

debugTextOptions :object

Settings used by the default implementation of drawable.debug().

Properties:
Name Type Attributes Default Description
font string 'monospace'

Font to use when drawing with debug()

font number <optional>
rac.textFormatDefaults.size

Font size to use when drawing with debug()

fixedDigits number 2

Number of decimal digits to print when drawing with debug()

debugTextStyle :object

Style used for text for debug drawing, when null the style already applied is used.

strokeWeightFactor :number

Factor applied to stroke weight setting. Stroke weight is set to stroke.weight * strokeWeightFactor when applicable.

Default Value:
  • 1

Methods

setDebugFunction(drawableClass, debugFunction)

Sets the given debugFunction to perform the debug-drawing for instances of class drawableClass.

When a drawable class does not have a debugFunction setup, calling drawable.debug() simply calls draw() with debugStyle applied.

debugFunction is expected to have the signature:

debugFunction(drawer, objectOfClass, drawsText)
  • drawer: P5Drawer - Instance to use for drawing
  • objectOfClass: drawableClass - Instance of drawableClass to draw
  • drawsText: bool - When true text should be drawn with additional information.
Parameters:
Name Type Description
drawableClass class

Class of the instances to draw

debugFunction function

Function that performs debug-drawing

setDrawFunction(drawableClass, drawFunction)

Sets the given drawFunction to perform the drawing for instances of class drawableClass.

drawFunction is expected to have the signature:

drawFunction(drawer, objectOfClass)
  • drawer: P5Drawer - Instance to use for drawing
  • objectOfClass: drawableClass - Instance of drawableClass to draw
Parameters:
Name Type Description
drawableClass class

Class of the instances to draw

drawFunction function

Function that performs drawing