Giovanna Bembo – Pattern

BIPOLARISMO è un pattern interattivo, le faccine, al click nella canvas diventano tristi. Forse vogliono essere lasciate in pace…

function setup() {
createCanvas(400, 400);
stroke(0);
strokeWeight(3);
}
function draw() {
if (mouseIsPressed) {
//richiamo funzione triste
drawSad();
} else {
//richiamo a funzione felice
drawHappy();
}
}
function drawHappy(){
//imposto colori
background(‘#FFD1E8’);
fill(‘#FFE608’);
let cols = 5;
let rows = 5;
let cellW = width / cols;
let cellH = height / rows;
for (let a = 0; a < cols; a++) {
for (let b = 0; b < rows; b++) {
//movimento nelle caselle della mia griglia let x = a * cellW + cellW / 2; let y = b * cellH + cellH / 2; push(); translate(x, y); //faccia (centrata sull'origine)ellipse(0, 0, 60, 60); // occhi line(-10, -8, -10, 2); // occhio sinistro line(8, -8, 8, 2); // occhio destro // bocca felice bezier(-15, 8, -6, 18, 6, 18, 15, 8) pop(); }
}
}
function drawSad(){
background(‘#E4E4E4’)
fill(‘#A4B7C1’);
let cols = 5;
let rows = 5;
let cellW = width / cols;
let cellH = height / rows;
for (let a = 0; a < cols; a++) {
for (let b = 0; b < rows; b++) {
let x = a * cellW + cellW / 2; let y = b * cellH + cellH / 2; push(); translate(x, y); // faccia (centrata sull'origine) ellipse(0, 0, 60, 60); // occhi line(-10, -8, -10, 2); // occhio sinistro line(8, -8, 8, 2); // occhio destro // bocca triste (curva invertita) bezier(-15, 16, -6, 6, 6, 6, 15, 16); pop(); }
}
}

Commenti

Lascia un commento