Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F64507584
Game.pde
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, May 27, 09:20
Size
1 KB
Mime Type
text/x-java
Expires
Wed, May 29, 09:20 (2 d)
Engine
blob
Format
Raw Data
Handle
17914111
Attached To
rBAFOURPROJECT InfoVisuGit
Game.pde
View Options
import java.text.DecimalFormat;
float depth = 2000;
float plate_w=1000;
float plate_t=plate_w/20;
float x_coord;
float y_coord;
float mX;
float mY;
float speed=10;
DecimalFormat f = new DecimalFormat("#0.0");
float variable=0;
void settings() {
size(displayWidth, displayHeight, P3D);
//size(1000, 1000, P3D);
x_coord=width/2;
y_coord=height/2;
}
void setup() {
//noStroke();
}
void draw() {
pushMatrix();
camera(0, -400, depth, 0, 0, 0, 0, 1, 0);
directionalLight(50, 100, 125, 0, 1, 0);
ambientLight(102, 102, 102);
background(200);
float rz = map(x_coord, 0, width, -PI/3, PI/3);
float rx = map(y_coord, 0, height, -PI/3, PI/3);
rotateZ(rz);
rotateX(rx);
box(plate_w, plate_t, plate_w);
popMatrix();
fill(255);;
text("Rotation X : "+f.format(rx/Math.PI*180)+"° Rotation Z : "+f.format(rz/Math.PI*180)+"° speed: "+f.format(speed/10), 5, 15);
}
void mouseWheel(MouseEvent event) {
float e = event.getCount();
if(e<0){
speed-=speed<=2?0:1;
}else{
speed+=speed>=15?0:1;
}
}
void mouseDragged() {
float d=-(mX-mouseX)*speed/10;
x_coord=x_coord+d<=0?0:x_coord+d>=width?width:x_coord+d;
mX=mouseX;
d=(mY-mouseY)*speed/10;
y_coord=y_coord+d<=0?0:y_coord+d>=height?height:y_coord+d;
mY=mouseY;
}
void mousePressed() {
mX=mouseX;
mY=mouseY;
}
void keyPressed() {
if (key == CODED) {
if (keyCode == UP) {
variable -= 50;
} else if (keyCode == DOWN) {
variable += 50;
}
}
}
Event Timeline
Log In to Comment