Reference strokeWeight()

strokeWeight()

Sets the width of the stroke used for points, lines, and the outlines of shapes.

Note: In 2D mode, strokeWeight() is affected by transformations, especially calls to scale(). It isn't affected by transformations in WebGL and WebGPU modes.

Calling strokeWeight() without an argument returns the current stroke weight as a number.

Examples

Syntax

strokeWeight(weight)
strokeWeight()

Parameters

weight
Number: the weight of the stroke (in pixels).

Returns

Number: the current stroke weight.

Related References