Reference for Processing version 1.2. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.

Name

strokeWeight()

Examples
example pic
smooth();
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.

With P2D, P3D, and OPENGL, series of connected lines (such as the stroke around a polygon, triangle, or ellipse) produce unattractive results when strokeWeight is set (Bug 955).

When used with P3D, strokeWeight does not interpolate the Z-coordinates of the lines, which means that when rotated, these flat lines will disappear (Bug 956). The OPENGL renderer setting does not share this problem because it always draws lines perpendicular to the screen.

When using OPENGL, the minimum and maximum values for strokeWeight() are controlled by the graphics card and the operating system's OpenGL implementation. For instance, the weight may not go higher than 10.
Syntax
strokeWeight(width)
Parameters
width int or float: the weight (in pixels) of the stroke
Returns None
Usage Web & Application
Related stroke()
strokeJoin()
strokeCap()
Updated on June 14, 2010 12:05:29pm EDT

Creative Commons License