float x = 0.6;
float y = 0.9;
float easing = 0.08;
float targetX, targetY;
boolean shaking= false;
PImage exclamation;
void setup(){
size(400,400);
smooth();
noStroke();
fill(170);
background(0);
exclamation= loadImage("graysquare1_01.jpg");
}
void draw(){
background (0);
targetX = mouseX;
targetY = mouseY;
x+= (targetX -x) * easing;
y+= (targetY -y) * easing;
float speed = dist(mouseX, mouseY, pmouseX-80, pmouseY-80);
rectMode(CENTER);
rect(x, y, 30, 30);
shaking = true;
x += random(-5, 5);
y += random (-5, 5);
if (mousePressed == true) {
image (exclamation, 2,2);
}
}
Monica - H
on Wednesday, Oct 22, 2008 – 3:20 am