xxxxxxxxxx
40
let detailX;
// slide to see how detailX works
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
}
function draw() {
/* let muovi_x = map(mouseX, windowWidth,windowHeight, 0, 100 )
background(0);
rotateY(millis() / 1000);
translate(0, muovi_x, 0);
sphere(40, 16, 16); */
background(0);
noFill();
stroke(255, 255, 255, 50);
rectMode(CORNER);
rotateX(0);
rect(-windowWidth * 0.5 + 30, -windowHeight * 0.5 + 30, windowWidth - 60, windowHeight - 60);
stroke(255, 255, 255, 255);
push();
translate(-millis() / 100, -millis() / 100, 0);
triangle(30, 75, 58, 20, 86, 75);
pop();
poligono(0, 0, 10, 3);
}
function poligono(x, y, raggio, numero_punti) {
let angolo = TWO_PI / numero_punti;
beginShape();
for (let a = 0; a < TWO_PI; a += angolo) {
let sx = x + cos(a + HALF_PI * 0.2) * raggio;
let sy = y + sin(a + HALF_PI) * raggio;
vertex(sx, sy);
}
endShape(CLOSE);
}