Skip to content

Instantly share code, notes, and snippets.

@darkwave
Created October 11, 2014 10:14
Show Gist options
  • Save darkwave/8df94723a0fa5d76de9d to your computer and use it in GitHub Desktop.
Save darkwave/8df94723a0fa5d76de9d to your computer and use it in GitHub Desktop.
Esempio Element
import remixlab.proscene.*;
Scene scene;
Element elemento1, elemento2, elemento3;
void setup() {
size(displayWidth, displayHeight, P3D);
scene = new Scene(this);
elemento1 = new Element(0, 0, 0);
elemento2 = new Element(100, 0, 0);
elemento3 = new Element(0, 0, 100);
}
void draw() {
background(0);
elemento1.display();
elemento2.display();
elemento3.display();
}
void keyPressed() {
if (keyCode == LEFT) {
elemento3.x -= 10;
}
}
class Element {
float x, y, z;
float rotX, rotY, rotZ;
float scala = 1;
Element(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
// questo blocco decide cosa appare per ogni elemento
void display() {
pushMatrix();
translate(x, y, z);
scale(scala);
box(50);
popMatrix();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment