clone()

Returns a shallow copy of the quadrille.

Example

(click on canvas and / or press any key)

edit, then run

Note

Shallow means cell values are shared references. Clicking mutates the shared color1 instance in place — both quadrilles change together, since their cells point at the same object. Pressing a key instead replaces color2 in the twin only with a fresh instance — the original keeps the old one. Same identity story as fill(value) and strict search.

Syntax

clone()

What this page's examples use
p5.quadrille
drawQuadrille createQuadrille cellLength clone
p5.js
createCanvas background color random

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.