xxxxxxxxxx
55
let cirx;
let d;
let row;
let r, g, b;
let fish;
function preload() {
fish = loadImage("fishsmall.png");
}
function setup() {
createCanvas(680, 680);
noStroke();
noCursor();
}
function draw() {
background('white');
row = 0;
inc = 75;
for (let y = -5; y <= height + 180; y += 48) {
if (row % 2 == 1) {
cirx = 0;
} else {
cirx = 84;
}
for (let x = cirx; x <= width; x += 170) {
for (let icircle = 9; icircle > 0; icircle--) {
if (icircle % 2 == 0) {
r = mouseX - (row * 10);
g = (row * 10);
b = (row * 20);
fill(r, g, b);
} else if (icircle % 2 == 1) {
fill('white');
}
//increase diameter of each circle by 20px
d = icircle * 20;
//draw circle 1
circle(x, y, d);
}
}
row++
}
image(fish, mouseX, mouseY);
}