fill(value)
Fills all empty cells in the quadrille with the specified value — filled cells are never overwritten (to re-value those, use replace(value); to start over, clear first). Returns the quadrille (chainable).
Example
(click or press a key to toggle between filling empty cells and resetting to random colors)
Note
Empty cells appear black because the background is set to black (
background(0)), while the fill color is white (fill(255)).
Note
One value, one instance. A non-factory
valueis stored as-is in every cell: all cells filled by the call share the same instance. That single fact powers two idioms elsewhere in the API — strict search matches across cells (===), and flood fill/flood clear treat them as one connected region, since the flood matches the start cell's value by identity. Per-cell instances instead — e.g. a freshcolor('green')per cell viaQuadrille.factory— would strict-match nothing and flood nowhere. When sharing is the point,Quadrille.singleton(value)names the intent in code: a pure identity function — the value passes through unmodified — that reads as the semantic mirror ofQuadrille.factory.
Syntax
fill(value)
Parameters
| Param | Description |
|---|---|
value1 |
Any: A valid JavaScript value |
- A plain function
valueis stored, not called — it becomes a per-cell display routine, invoked with theoptionsobject alone —({ row, col, origin }) => { ... }— and withthisbound to the drawing context (see display functions). To have a function evaluated per cell at fill time — a fresh object or a varied tile per cell — tag it:Quadrille.factory(({ row, col }) => new Object(...)), which marks the function in place and returns that same function. ↩
What this page's examples use
- p5.quadrille
drawQuadrillecreateQuadrillecellLengthrandfill- p5.js
createCanvasbackgroundcolor
Names the analysis can prove are called, and the line each one is documented on. Local variables and members of an unknown receiver are left out.