xxxxxxxxxx
44
let numero_punti = 6; //cambia per incrementare o ridurre punti disegnati
let punto_x = [];
let punto_y = [];
let dens_punti_x;
let dens_punti_y;
function setup() {
cnv = createCanvas(windowWidth, windowHeight);
background (120);
dens_punti_x = width / (numero_punti + 1);
dens_punti_y = height / (numero_punti + 1);
for (let y = dens_punti_y; y < height; y+= dens_punti_y) {
punto_y[y] = y;
for (let x = dens_punti_x; x < width; x+= dens_punti_x) {
strokeWeight(4); //larghezza punto
punto_x[x] = x;
point(punto_x[x], punto_y[y]); //disegno punto
}
}
}
function draw () {
triangle(punto_x[0], punto_y[0],
punto_x[1], punto_y[1],
punto_x[2], punto_y[2]);
}