// BSPACE OBJECT ARRAY
int num = 200; // number of BSpace objects to create.
float angle = 0; // rotation angle
BSpace[] s = new BSpace[num]; // create an array of BSpace objects.
void setup(){
size(300,300);
background(200);
smooth();
noStroke();
// create a BSpace Object in each array element, and set its Axis.
for ( int i = 0; i < num; i++){
s[i] = new BSpace(this);
s[i].setAxis(random(0,width), random(0,height),-i); // move the Axis according to stored x/y positions.
// also, use i for Z (3rd dimention) positioning.
}
}
void loop(){
angle += 0.005; // increase the rotation angle
for ( int i = 0; i < num; i++){
s[i].rotateX(i*angle); // rotate each BSpace according to its i element number.
fill(i);
s[i].rect(0,0,3,80); // place a rectangle inside each Bspace
}
}
|