- Processing
- p5.js
- Processing.py
- Processing for Android

- Processing Foundation

This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Class | PShape
Name | ### setStroke()
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);
    }
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.
Syntax |
    sh.setStroke(stroke)
Parameters |
sh | PShape: any variable of type PShape
Returns | void

Updated on November 10, 2017 05:36:30pm EST