Skip to content

Latest commit

 

History

History
82 lines (63 loc) · 1.51 KB

delete.md

File metadata and controls

82 lines (63 loc) · 1.51 KB
weight draft
1
false

delete()

Deletes a row from the quadrille.

Example

(click on any cell; press any key to reset)
{{< p5-global-iframe quadrille="true" width="425" height="425" >}} use strict; Quadrille.cellLength = 20; let quadrille;

function setup() { createCanvas(400, 400); reset(); }

function draw() { background('orange'); drawQuadrille(quadrille); }

function mouseClicked() { quadrille.delete(quadrille.mouseRow); }

function keyPressed() { reset(); }

function reset() { quadrille = createQuadrille(20, 20, 100, color('red')); quadrille.rand(100, color('green')).rand(100, color('blue')). rand(100, color('cyan')); } {{< /p5-global-iframe >}}

{{< details title="code" open=false >}}

Quadrille.cellLength = 20;
let quadrille;

function setup() {
  createCanvas(400, 400);
  reset();
}

function draw() {
  background('orange');
  drawQuadrille(quadrille);
}

function mouseClicked() {
  quadrille.delete(quadrille.mouseRow);
}

function keyPressed() {
  reset();
}

function reset() {
  quadrille = createQuadrille(20, 20, 100, color('red'));
  quadrille.rand(100, color('green')).rand(100, color('blue')).
            rand(100, color('cyan'));
}

{{< /details >}}

Syntax

delete(row)

Parameters

parameter description
row Number: number of row to be deleted [[0..height]]({{< ref "height" >}})