/*based off my bunny's social habits;
do nothing to let the bunny roam.
move the mouse and she will follow u around(w/getting too close).
click and hold to call give her a treat.
click rapidly to scare her.
*/
float angle = 0.0;
int frame = 0;
boolean moving = false;
float easing = 0.02;
float y=0;
float x=0;
float r =random(0,355);
float r2 = random (100, 300);
float r3 = random (15, 400);
void setup(){
size(400, 400);
smooth();
noStroke();
background(0);
frameRate(24);
}
void draw(){
background(0);
if (mousePressed== true) {
float easing = (.02);
float targetX=mouseX;
float targetY=mouseY;
x += (targetX -x)*easing;
y += (targetY -y)*easing;
rect(x, y, 20, 20);
}else if (moving == false) {
rect(r++, r2++, 20, 20);
fill(150);
float easing = (.7);
if ((r >= 355) || (r2 >= 355)){
r=0;
r2=r3;
}
}
moving = false;
}
void mouseMoved(){
moving = true;
float r4 = random(5,15);
float r5 = random(2,20);
float targetX=mouseX;
float targetY=mouseY;
x += ((targetX -x))*easing;
y += ((targetY -y))*easing;
rect(x+r4++, y+r5++, 20, 20);
}
void mousePressed(){
float mp1 = random (5, 150);
float mp2 = random (10, 160 );
rect(x, y, 20+mp1, 20+mp2);
}
Alex - H
on Wednesday, Oct 22, 2008 – 7:52 am