Hey - Thanks again - your help is much appreciated. i under estimated the time it would take me to pick this up.
I have slightly modified the code - i wanted to create a few more bar plots. In doing so, im not exactly sure what to call it, but the red image is not as clear as the blue, im not sure what is causing this. Also, the height of sbs3 is not as random as sbs2/1. Any ideas would be great - but again, thanks for all the help you have provided.
class SingleBar {
float px, py, pz;
float sx, sy, sz;
color c;
SingleBar(float ipx, float ipy, float ipz, float h) {
px = ipx;
py = ipy;
pz = ipz;
sx = sz = 60;
sy = h;
c = color( 0,0,255,20);
}
void draw() {
pushMatrix();
translate(px, py, pz);
translate(0,-sy/2,0);
fill©;
box(sx, sy, sz);
popMatrix();
}
}
class SingleBar2 {
float px, py, pz;
float sx, sy, sz;
color c;
SingleBar2(float ipx, float ipy, float ipz, float h) {
px = ipx;
py = ipy;
pz = ipz;
sx = sz = 60;
sy = h;
c = color( 255,0,0,20);
}
void draw() {
pushMatrix();
translate(px, py, pz);
translate(0,-sy/2,0);
fill©;
box(sx, sy, sz);
popMatrix();
}
}
class SingleBar3 {
float px, py, pz;
float sx, sy, sz;
color c;
SingleBar3(float ipx, float ipy, float ipz, float h) {
px = ipx;
py = ipy;
pz = ipz;
sx = sz = 30;
sy = h;
c = color( 255,255,255,200);
}
void draw() {
pushMatrix();
translate(px, py, pz);
translate(0,-sy/2,0);
fill©;
box(sx, sy, sz);
popMatrix();
}
}
ArrayList sbs = new ArrayList();//SingleBar[10];
ArrayList sbs2 = new ArrayList();//SingleBar[10];
ArrayList sbs3 = new ArrayList();//SingleBar[10];
int offset = 0;
final int OFFSET_SPEED = 6;
final int MAX_BARS = 300;
float atX = 0;
float atZ = 0;
void setup() {
size(1000, 1000, P3D);
noStroke();
}
void draw() {
background(0);
translate(width/2, height/2);
lights();
rotateY(-map(mouseX, 0, width, -HALF_PI, HALF_PI));
rotateX(map(mouseY, 0, height, -PI, PI));
translate(0,0,atZ-offset);
for( int i = 0; i< sbs.size(); i++){
sbs.get(i).draw();
}
pushMatrix();
translate(-200,0,0);
for( int j = 0; j< sbs2.size(); j++){
sbs2.get(j).draw();
}
popMatrix();
pushMatrix();
translate(-75,0,0);
for( int k = 0; k< sbs3.size(); k++){
sbs3.get(k).draw();
}
popMatrix();
if( offset > 60 ){
atZ -= 60;
offset %= 60;
for( int i = 1; i < 10; i+=2){
sbs.add( 0, new SingleBar(30*i, 170, -atZ, random(60,300)) );
for( int j = 1; j < 10; j+=2){
sbs2.add( 0, new SingleBar2(-30*j, 170, -atZ, random(60,300)) );
for( int k = 1; k < 2; k+=2){
sbs3.add( 0, new SingleBar3(-15*k, 170, -atZ, random(0,75)) );
}
}
} }
offset+=OFFSET_SPEED;
}