Thursday, September 07, 2006

heavy-light med bevegelse


int size = 8;
int legth = 50;

int aSize; // Height of the shape
float aPos; // Position of shape
float aSpeed; // Speed of the shape
int aDirection = 1; // Left or Right

float bPos;
float bSpeed;
int bDirection = 1;

float cPos;
float cSpeed;
int cDirection = 1;

float dPos;
float dSpeed;
int dDirection = 1;


void setup()
{
size(600, 600);
framerate(60);
aPos = bPos = cPos = dPos = width/2;
}

void draw()
{
background(50);

if(mousePressed) {
background(200);
rect(100,100,450,450);
fill(150);
aSpeed = squared(aPos/float(width-size)) * 6.0;
aPos = aPos + ((aSpeed*8.0+0.75) * aDirection );
if (aPos > width-size || aPos < adirection =" aDirection" dspeed =" quadHump(dPos/float(width-size))" dpos =" dPos"> width-size || dPos < ddirection =" dDirection" sa =" (sa" sa =" sa*sa*sa*sa" sa =" (sa" sa =" sa*sa;"> 1) {
sa = 1;
}
return 1-sa;
}

float squared(float sa) {
sa = sa*sa;
return sa;
}

No comments: