xxxxxxxxxx
36
/*
----- Coding Tutorial by Patt Vira -----
Name: Mouse-following Dials (OOP)
Video Tutorial: https://youtu.be/4lCD9B4Dlik?si=j3fyEDdCHjoMFzyC
Connect with Patt: @pattvira
https://www.pattvira.com/
----------------------------------------
*/
let dials = [];
let cols; let rows;
let size = 20;
function setup() {
createCanvas(400, 400);
rectMode(CENTER);
cols = width/size;
rows = height/size;
for (let i=0; i<cols; i++){
dials[i] = [];
for (let j=0; j<rows; j++){
dials[i][j] = new Dial(size/2 + i*size, size/2 + j*size, size);
}
}
}
function draw() {
background(220);
for (let i=0; i<cols; i++){
for (let j=0; j<rows; j++){
dials[i][j].rotateDial();
}
}
}