Fills all empty cells in the quadrille with the specified value
.
Example #
(click or press a key to toggle between filling empty cells and resetting to random colors)
code
Quadrille.cellLength = 20;
let quadrille;
let filled = false;
function setup() {
createCanvas(400, 400);
reset();
}
function draw() {
background(0);
drawQuadrille(quadrille);
}
function mouseClicked() {
filled = !filled;
filled ? quadrille.fill(255) : reset();
}
function keyPressed() {
filled = !filled;
filled ? quadrille.fill(255) : reset();
}
function reset() {
quadrille = createQuadrille(20, 20, 100, color('red'));
quadrille.rand(100, color('lime')).rand(100, color('blue'));
}
Empty cells appear black because the background is set to black (background(0)
), while the fill color is white (fill(255)
).
Syntax #
fill(value)
Parameters #
Param | Description |
---|---|
value | Any: A valid JavaScript value |