heatMap(hot, cold)
Returns this quadrille's numbers as a new color quadrille: hot at 0, cold at the largest number present, lerpColor in between. Number cells map to colors; every other cell comes back empty, so a reach field maps to exactly its reachable region — and keeps its numbers, since the result is a new quadrille.
Example
(move the mouse to seed the field; click to regenerate the maze)
Note
The scale is the field's own maximum, read per call — dimensions cannot supply it, since the same board runs a much longer distance through a maze than in the open. The ramp is anchored at
0, not at the smallest number present: a quadrille whose numbers start at1never reaches fullhot, and negatives clamp to it.
Note
Omitting
colduses the hue complement ofhot(an achromatichotinverts lightness instead:heatMap(color(255))runs white to black). Passing it is usually better — an analogous pair such asheatMap(color('yellow'), color('red'))reads as one gradient rather than two poles. A translucentcoldturns the field into an overlay.
Syntax
heatMap([hot], [cold])
Parameters
| Param | Description |
|---|---|
hot |
p5.Color | String: color at 0; default is Quadrille.outline |
cold |
p5.Color | String: color at the largest number; default is the hue complement of hot |
What this page's examples use
- p5.quadrille
drawQuadrillecreateQuadrillecellLengthmouseRowmouseColmazereach- 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.