Colorize

colorize() #

Colorize quadrille according to upper-left corner color0, bottom-left corner color1, upper-right corner color2, and bottom-right corner color3 colors. Call colorizeTriangle() on the two non-overlapping triangles entirely covering the quadrille.

Example #

code
const ROWS = 20;
const COLS = 20;
const LENGTH = 20;
let quadrille;

function setup() {
  createCanvas(COLS * LENGTH, ROWS * LENGTH);
  quadrille = createQuadrille(20, 20);
  quadrille.colorize('red', 'green', 'blue', 'cyan');
}

function draw() {
  drawQuadrille(quadrille, { cellLength: LENGTH, outline: 'green' });
}

Syntax #

colorize(color0, [color1], [color2], [color3])

Parameters #

parameterdescription
color0p5.Color : corner0 color to be interpolated
color1p5.Color : corner1 color to be interpolated default is color0
color2p5.Color : corner2 color to be interpolated default is color0
color3p5.Color : corner2 color to be interpolated default is color0