Following with my assignment from last week which made several shapes vibrate, I wanted to make the letters vibrate for this week’s assignment.
I also wanted to incorporate some human quality into the project so I thought of the vibrating motion as “tickling” and I made the letters “run away” from the mouse which “tickles” them.
import geomerative.*;
String text = "Yoon Hee";
float x = 190;
float y = 180;
void setup() {
size(640, 360);
background(255);
textSize(50);
noStroke();
}
void draw() {
fill(204);
rect(0, 0, width, height);
fill(0);
text("Yoon Hee", x, y);
if (mousePressed == true) {
x += random(-2, 2);
y += random(-2, 2);
text("Yoon Hee", x, y);
} else {
text("Yoon Hee", x, y);
}
}
void mousePressed() {
if ((mouseX >= x) && (mouseX <= x+30) &&
(mouseY >= y-5) && (mouseY <= y)) {
x += random(-2, 2);
y += random(-2, 2);
}
}