Reference+
Name
setStroke()
Class
PShape
Description
The setStroke() method defines the outline color of a PShape. This method is used after shapes are created or when a shape is defined explicitly (e.g. createShape(RECT, 20, 20, 80, 80)) as shown in the above example. When a shape is created with beginShape() and endShape(), its attributes may be changed with fill() and stroke() within beginShape() and endShape(). However, after the shape is created, only the setStroke() method can define a new stroke value for the PShape.
Examples
- PShape circle; void setup() { size(640, 360, P2D); circle = createShape(ELLIPSE, 0, 0, 200, 200); circle.setStroke(color(255)); } void draw() { background(51); circle.setFill(color(random(255))); translate(mouseX, mouseY); shape(circle); }
Syntax
- sh.setStroke(stroke)
Parameters
- sh- (PShape)any variable of type PShape
Return
- void

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.