White's Illusion
When I'm not walking along the beach at Aberdyfi, I like to code in p5js. This is an example of White's Illusion. The two squares are the same colour. Below is the code to make it yourself.
function setup() {
createCanvas(400, 400);
noStroke();
}
function draw() {
background(0);
fill('blue');
rect(250,50, 100,100);
fill(255);
rect(0,200,400,200);
fill('blue');
rect(50, 250, 100, 100);
for (let i=0; i < 210; i+=20){
fill(255);
rect(0,i, 400, 10);
}
for (let i = 210; i< 400; i+=20){
fill(0);
rect(0,i, 400, 10);
}
}

Comments
Post a Comment