|
// bounce
float x,y,z,a,i,k;
//direction=
int x_direction;
int y_direction;
int z_direction;
int a_direction;
int k_direction;
float x_speed;
float y_speed;
float z_speed;
float a_speed;
float k_speed;
float mouse_speed;
void setup(){
size(300,300);
//don't forget
x_direction=1;
y_direction=1;
z_direction=2;
a_direction=1;
k_direction=1;
//?
x=width/2;
y=height/2;
z=width/2;
x_speed=1.2;
y_speed=2.8;
z_speed=0.5;
a_speed=0.01;
k_speed=1.0;
}
void loop(){
background(255);
DrawObject1();
}
//object1 ------------------------
void DrawObject1(){
mouse_speed=mouseX/50;
x=x+x_direction*x_speed*mouse_speed;
y=y+y_direction*y_speed*mouse_speed;
z=z+z_direction*z_speed*mouse_speed;
a=a+a_direction*a_speed;
k=x/2+y/2+z/2;
//?
noFill();
triangle(x,y,z,x,y,z);
//
fill(200,z,x);
strokeWeight(1);
stroke(y,x,200);
ellipse(x,y,15,15);
rect(z,x,15,15);
rect(y,z,15,15);
fill(255,0,0);
ellipse(k,k,15,15);
stroke(y,x,200);
strokeWeight(a);
curve(x,y,z,x,y,z,k,k);
//return
if(x>300-15 || x<30){
x_direction= x_direction*-1;
}
//|| = or
if(y>300-15 || y<30){
y_direction= y_direction*-1;
}
if(300-15 3 || a<0){
a_direction=a_direction*-1;
}
if(k>300-15 || k<0){
k_direction=k_direction*-1;
}
for(i=0; i<300 ; i=i+10){
rect(0,i,30,30);}
}
|