xxxxxxxxxx
52
/*
----- Coding Tutorial by Patt Vira -----
Name: Magnifying Glass
Video Tutorial: https://youtu.be/e3gwnn4H2vA
Connect with Patt: @pattvira
https://www.pattvira.com/
----------------------------------------
*/
let cols; let rows; let size = 40;
let colors;
let x; let y; let scl = 3;
let img;
// function preload() {
// img = loadImage("images/makeart.png");
// }
function setup() {
createCanvas(400, 400);
cols = width/size;
rows = height/size;
ellipseMode(CORNER);
colors = ["#abcd5e", "#14976b", "#2b67af", "#62b6de", "#f589a3", "#ef562f", "#fc8405", "#f9d531"];
}
function draw() {
background(255);
strokeWeight(2);
for (let i=0; i<cols; i++) {
for (let j=0; j<rows; j++) {
let index = j*rows + i;
fill(colors[index % colors.length]);
let x = i*size;
let y = j*size;
ellipse(x, y, size, size);
}
}
// image(img, 0, 0);
x = mouseX;
y = mouseY;
copy(x, y, size, size, x, y, size*scl, size*scl);
noFill();
strokeWeight(5);
rect(x, y, size*scl, size*scl);
}