stroke_cap()

Sets the style for rendering line endings.

Examples

example picture for stroke_cap()
1
2
3
4
5
6
7
8
def setup():
    py5.stroke_weight(12.0)
    py5.stroke_cap(py5.ROUND)
    py5.line(20, 30, 80, 30)
    py5.stroke_cap(py5.SQUARE)
    py5.line(20, 50, 80, 50)
    py5.stroke_cap(py5.PROJECT)
    py5.line(20, 70, 80, 70)

Description

Sets the style for rendering line endings. 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.

To make point() appear square, use stroke_cap(PROJECT). Using stroke_cap(SQUARE) (no cap) causes points to become invisible.

Underlying Java method: strokeCap

Syntax

stroke_cap(cap: int, /) -> None

Parameters

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

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