Name

strokeWeight()

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().

Examples

  • size(400, 400);
    strokeWeight(4);  // Default
    line(80, 80, 320, 80);
    strokeWeight(16);  // Thicker
    line(80, 160, 320, 160);
    strokeWeight(40);  // Beastly
    line(80, 280, 320, 280);
    Image output for example 1

Syntax

  • strokeWeight(weight)

Parameters

  • weight(float)the weight (in pixels) of the stroke

Return

  • void