Sets the style for wrapping text when text() is called.
The parameter, style
, can be one of the following values:
WORD
starts new lines of text at spaces. If a string of text doesn't have spaces, it may overflow the text box and the canvas. This is the default style.
CHAR
starts new lines as needed to stay within the text box.
textWrap()
only works when the maximum width is set for a text box. For example, calling text('Have a wonderful day', 0, 10, 100)
sets the maximum width to 100 pixels.
Calling textWrap()
without an argument returns the current style.
Examples
Syntax
textWrap(style)
textWrap()
Parameters
Returns
Related References
textToContours
Returns an array of arrays of points outlining a string of text written using the font.
textToModel
Converts text into a 3D model that can be rendered in WebGL mode.
textToPaths
Returns a flat array of path commands that describe the outlines of a string of text.
textToPoints
Returns an array of points outlining a string of text written using the font.