Py5Shape.stroke_cap()#

Sets the style for rendering line endings in a Py5Shape object.

Examples#

example picture for stroke_cap()
 1def make_line(cap):
 2    s = py5.create_shape()
 3    s.begin_shape()
 4    s.stroke_weight(12.0)
 5    s.stroke_cap(cap)
 6    s.vertex(20, 0)
 7    s.vertex(80, 0)
 8    s.end_shape()
 9    return s
10
11
12def setup():
13    py5.shape(make_line(py5.ROUND), 0, 30)
14    py5.shape(make_line(py5.SQUARE), 0, 50)
15    py5.shape(make_line(py5.PROJECT), 0, 70)

Description#

Sets the style for rendering line endings in a Py5Shape object. These ends are either squared, extended, or rounded, each of which specified with the corresponding parameters: SQUARE, PROJECT, and ROUND. The default cap is ROUND.

This method can only be used within a Py5Shape.begin_shape() and Py5Shape.end_shape() pair.

Underlying Processing method: PShape.strokeCap

Syntax#

stroke_cap(cap: int, /) -> None

Parameters#

  • cap: int - either SQUARE, PROJECT, or ROUND

Updated on November 12, 2021 11:30:58am UTC