shift(dRow, dCol, wrap)

Shifts cells by a row/column offset. Returns this quadrille (chainable).

  • dRow moves down when positive; up when negative.
  • dCol moves right when positive; left when negative.
  • With wrap on (default) it wraps around; with wrap off it slides, leaving empty cells behind.

Note

For a non-destructive static version, call Quadrille.shift(q, dRow, dCol, wrap).

Example

(drag to shift; press any key to reset)

edit, then run

Syntax

shift(dRow, dCol, [wrap = true])

Parameters

Param Description
dRow Number. Rows to move: positive down, negative up
dCol Number. Columns to move: positive right, negative left
wrap Boolean (default true). When on, the grid wraps around; when off, it slides and leaves empty spaces
What this page's examples use
p5.quadrille
drawQuadrille createQuadrille cellLength mouseRow mouseCol outlineWeight isValid shift
p5.js
createCanvas background position createCheckbox checked style

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.