Number Display

numberDisplay #

Static method for drawing cells that are filled with numbers. Implemented in terms of Quadrille.colorDisplay as: Quadrille.colorDisplay({ graphics: graphics, cell: graphics.color(graphics.constrain(cell, 0, 255)), cellLength: cellLength }).

Used by drawQuadrille and sample.

Example #

code
let number;

function setup() {
  createCanvas(165, 165);
  number = createSlider(0, 255, 125, 1);
}

function draw() {
  background('blue');
  Quadrille.numberDisplay({graphics: this, value: number.value(), cellLength: width});
}

Syntax #

Quadrille.numberDisplay({graphics, value, [cellLength]})

Parameters #

parameterdescription
graphicsp5.Graphics: renderer target
valueNumber: cell contents
cellLengthNumber: edge length in pixels default is Quadrille.cellLength