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 | |||
---|---|---|---|
Name | setFill() |
||
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 setFill() method defines the fill 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 setFill() method can define a new fill value for the PShape. | ||
Syntax | sh.setFill(fill) | ||
Parameters |
| ||
Returns | void |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.