Created
June 30, 2015 23:56
-
-
Save danbernier/168e8dff75b082119bae to your computer and use it in GitHub Desktop.
3D spheres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import peasy.*; | |
PeasyCam camera; | |
PVector[] spherePos; | |
void setup() { | |
size(800, 600, P3D); | |
camera = new PeasyCam(this, 0,0,0, 200); | |
setUpSpheres(); | |
} | |
void setUpSpheres() { | |
spherePos = new PVector[10]; | |
for (int i = 0; i < 10; i++) { | |
spherePos[i] = new PVector(random(100), random(100), random(100)); | |
} | |
} | |
void draw() { | |
lights(); | |
background(0); | |
//noStroke(); | |
for (int i = 0; i < spherePos.length; i++) { | |
pushMatrix(); | |
translate(spherePos[i].x, spherePos[i].y, spherePos[i].z); | |
sphere(20); | |
popMatrix(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment