Py5Shape.get_stroke()

Gets the stroke color used for lines and points in a Py5Shape object.

Examples

example picture for get_stroke()
1
2
3
4
5
6
7
8
def setup():
    py5.stroke_weight(4)
    py5.stroke(200, 50, 50)
    s = py5.create_shape(py5.RECT, 20, 20, 60, 60)
    py5.shape(s)

    stroke = s.get_stroke(0)
    py5.println(py5.red(stroke), py5.green(stroke), py5.blue(stroke)) # 200, 50, 50

Description

Gets the stroke color used for lines and points in a Py5Shape object. This method can get the stroke assigned to each vertex, but most likely the value will be the same for all vertices.

This method can only be used for a complete Py5Shape object, and never within a Py5Shape.begin_shape() and Py5Shape.end_shape() pair.

Underlying Processing method: PShape.getStroke

Syntax

get_stroke(index: int, /) -> int

Parameters

  • index: int - vertex index

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