Py5Shape.set_stroke_cap()

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

Examples

example picture for set_stroke_cap()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
def setup():
    s = py5.create_shape()
    s.begin_shape()
    s.stroke_weight(12.0)
    s.vertex(20, 0)
    s.vertex(80, 0)
    s.end_shape()

    py5.shape(s, 0, 30)
    s.set_stroke_cap(py5.SQUARE)
    py5.shape(s, 0, 50)
    s.set_stroke_cap(py5.PROJECT)
    py5.shape(s, 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 differs from Py5Shape.stroke_cap() in that it is only to be used outside the Py5Shape.begin_shape() and Py5Shape.end_shape() methods.

Underlying Java method: PShape.setStrokeCap

Syntax

set_stroke_cap(cap: int, /) -> None

Parameters

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

Updated on September 11, 2021 16:51:34pm UTC