This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Name

strokeWeight()

Examples
example pic
strokeWeight(1);  // Default
line(20, 20, 80, 20);
strokeWeight(4);  // Thicker
line(20, 40, 80, 40);
strokeWeight(10);  // Beastly
line(20, 70, 80, 70);
Description Sets the width of the stroke used for lines, points, and the border around shapes. All widths are set in units of pixels.

Using point() with strokeWeight(1) or smaller may draw nothing to the screen, depending on the graphics settings of the computer. Workarounds include setting the pixel using set() or drawing the point using either circle() or square().
Syntax
strokeWeight(weight)
Parameters
weight float: the weight (in pixels) of the stroke
Returnsvoid
Relatedstroke()
strokeJoin()
strokeCap()
Updated on January 1, 2021 03:38:08am EST