Hello, is it possible to scale a PImage by 10% when the mouse is over it and return to its normal size after the mouse is clicked?
void settings() {
size(1080, 720, P2D);
smooth();
}
void setup() {
//Sfondo
Uomo1 = loadImage("figura uomo 1.png");
Uomo2 = loadImage("figura uomo 2.png");
Foresta = loadImage("cold-fog-forest-1003124.jpg");
Foresta.resize(1080, 720);
Stanza = loadImage("castle-european-interiors-68389.jpg");
Stanza.resize(1080, 720);
background(0);
void draw() {
switch (i) {
case 0 :
textSize(50);
textAlign(CENTER);
text("PROGETTO PROCESSING", width/2, 360); //Titolo del progetto
fill(255);
textSize(30);
textAlign(CENTER);
text(".....................................", width/2, 500); //Campo con informazioni dello studente
fill(255);
if ( millis () - timer > 5000) {
timer = millis();
i++;
}
break;
case 1 :
background(Stanza);
if ( millis () - timer > 500 ){
image(Uomo1, 200, 400, 138, 415);
image(Uomo2, 650, 360, 138, 440);
}
beat.detect(player.mix);
fill(#1A1F18, 100);
noStroke();
rect(0, 0, width, height); //Grandezza della finestra della composizione
translate(width/2, height/2); //Posiziona la figura al centro della composizione
fill(-1, 10);
ellipse(0, 0, 2*rad, 2*rad);
stroke(-1, 50);
int bsize1 = player.bufferSize();
for (int i = 0; i < bsize1 - 1; i+=5) {
float x = (r)*cos(i*2*PI/bsize1);
float y = (r)*sin(i*2*PI/bsize1);
float x2 = (r + player.left.get(i)*100)*cos(i*2*PI/bsize1);
float y2 = (r + player.left.get(i)*100)*sin(i*2*PI/bsize1);
line(x, y, x2, y2);
if (testoClick & mouse == 1) {
textSize(35);
text(b1, CENTER, -230);
textAlign(CENTER);
fill(255);
}else if (testoClick & mouse == 2){
textSize(35);
text(b2, CENTER, -230);
textAlign(CENTER);
fill(255);
}else if (testoClick & mouse == 3){
textSize(35);
text(b3, CENTER, -230);
textAlign(CENTER);
fill(255);
}else if (testoClick & mouse == 4){
textSize(35);
text(b4, CENTER, -230);
textAlign(CENTER);
fill(255);
}else{
noFill();
}
}
beginShape();
noFill();
stroke(-1, 50);
endShape();
if ( (millis () - timer > 25000) | mouse == 5) {
timer = millis ();
i++;
}
break;
case 2:
background(Foresta);
image(Uomo1, 200, 400, 138, 415);
image(Uomo2, 650, 360, 138, 415);
beat.detect(player.mix);
fill(#1A1F18, 100);
noStroke();
rect(0, 0, width, height); //Grandezza della finestra della composizione
translate(width/2, height/2); //Posiziona la figura al centro della composizione
fill(-1, 10);
ellipse(0, 0, 2*rad, 2*rad);
stroke(-1, 50);
int bsize2 = player.bufferSize();
for (int i = 0; i < bsize2 - 1; i+=5) {
float x = (r)*cos(i*2*PI/bsize2);
float y = (r)*sin(i*2*PI/bsize2);
float x2 = (r + player.left.get(i)*100)*cos(i*2*PI/bsize2);
float y2 = (r + player.left.get(i)*100)*sin(i*2*PI/bsize2);
line(x, y, x2, y2);
}
beginShape();
noFill();
stroke(-1, 50);
endShape();
if ( millis () - timer > 1500) {
timer = millis();
i++;
}
break;
Thank you!