Spheres [] myspheres;
int numspheres = 5;
int centerX = 100;
int centerY = 100;
BImage ergon;
BImage thumb;
BImage fingers;
BImage ring;
BImage ring2;
BImage chest;
float a1;
float b1;
float c1;
float d1;
float e1;
float f1;
void setup ()
{
size (600,300);
framerate (60);
stroke (150,95,6);
ergon = loadImage("ergon.gif");
thumb = loadImage ("thumb.gif");
fingers = loadImage ("fingers.gif");
ring = loadImage ("ring.gif");
ring2 = loadImage ("ring2.gif");
chest = loadImage ("chest.gif");
myspheres = new Spheres [numspheres];
for (int i=0; i < numspheres; i++)
{
//float rx = random (100.0, 200.0);
//float ry = random (100.0, 200.0);
float rdia = random (15.0, 20.0);
float rspeed = random (.1, .70);
float rradius = random (10.0, 20.0);
myspheres [i] = new Spheres (rdia, rspeed, rradius);
}
}
void loop ()
{
background (0);
a1 += .1; //thumb float and chest heave
b1 += .01; // ring rotation
c1 +=.2; // chest rise
d1 += .02; //ring 2 rotation
e1 += .8; //fast hair
f1 += 1.0;
push();
translate(320,10);
rotate(b1);
image (ring, -500, -500, 1000,1000);
pop ();
push();
translate(70,390);
rotate(d1);
image (ring2, -200, -200, 400,400);
pop();
push();
translate (420,-30);
rotate (d1);
image (ring2, -100,-100, 200,200);
pop ();
push();
translate (580,340);
rotate (-d1);
image (ring2, -100,-100, 200,200);
pop ();
image(ergon, 250, 50, ergon.width/5.9, ergon.height/6);
image (thumb, 353,5*sin(a1)+120, thumb.width/7, thumb.height/7);
for (int i=0; i<numspheres; i++)
{
myspheres[i].update();
myspheres[i].display();
}
image (chest, cos(a1)+263, 1.5*sin(c1)+170, chest.width/5.9, chest.height/6);
image (fingers,330, 3*sin(a1)+120, fingers.width/5.9, fingers.height/6);
push();
line (300,90,1*cos(e1)+ 298,100); //hair left
line (320,90,2*cos(f1)+ 322,100); //hair right
line (3*cos(f1)+293, 54, 300, 64); //hair top
line (3*cos(e1)+305, 54,310,64);
pop ();
}
class Spheres
{
float diameter;
float speed;
float x = 100;
float y = 100;
float a;
float b;
float radius;
int dir = 1;
Spheres (float dia, float sp, float rad)
{
diameter = dia;
speed = sp;
radius = rad;
}
void update ()
{
push ();
translate (x,y);
pop ();
b += speed/9;
a += dir*speed/9;
if (a > 55 || a < 0)
{
dir = dir *-1;
}
if ( (mouseX-40)<x && x < mouseX + 40 && (mouseY - 40) < y && y < mouseY+ 40)
{
if (x > mouseX)
{
x = x - (3);
}
if (x < mouseX)
{
x= x + 3;
}
if (y > mouseY )
{
y -=3 ;
}
if (y < mouseY)
{
y += 3;
}
if (abs(mouseX-x) < 10 && abs (mouseY-y)<10 )
{
x = x + cos (millis()/100);
y= y + sin(millis()/100);
}
}
else
{
x = (radius + a/2) * cos(b) + 360;
y = (radius + a) * sin(b)+ 120;
}
}
void display ()
{
fill (187,159,97);
ellipse (x,y,diameter,diameter);
}
}