Sketch is different when put on web
in
Programming Questions
•
6 months ago
Hi
I'm new to processing and programming. I've just written the sketch below, When I run it, it does not work as I expected, when I put it on the web it works exactly how I intended.
Can anyone tell me what's going on, is there something wrong with my code or is there something I don't understand about how processing works?
here's how it looks on the web
http://www.b-s-a.co.nz/
float R = 100;
int base = 200;
int top = 500;
void setup() {
size(800, 800, P3D );
}
void draw() {
float TopRot = mouseX/200;
// lights();
background(0);
float camZ = (height/2.0) / tan(PI*60.0 / 360.0);
camera(400, mouseY, camZ, // Camera location
width/2.0, height/2.0, 0, // Camera target
0, 1, 0); // Camera orientation
translate (400, 600, 0);
rotateY(PI/2);
rotateX(PI/2);
for(float Div= 0; Div < 2*PI; Div = Div + PI/30) {
stroke(0, 140, 0);
strokeWeight(2);
line(R*sin(Div), R*cos(Div), base, R*sin(Div + TopRot), R*cos(Div + TopRot), top);
}
}
1