Source Code. Projects. Nerd Stuff. Art Stuff.

Graphics

 

 

[gn_spoiler title="orbitingPlanets" open="0" style="1"]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
float rot;

void setup() {
  size(640, 480, P3D);
  rectMode(CENTER);
 
  rot = 0;
}

void draw() {
  background(0);
 
  directionalLight(255, 255, 255, .25, 1, .33);
 
  pointLight(125, 0, 0, 0, 250, 650);
 
  rot += 0.01;
   
  // Sun  
  pushMatrix();
  noStroke();
  fill(255, 200, 0);
  translate(width/2, height/2);
  rotateY(rot);
  sphere(80);
 
  // Earth
  pushMatrix();
  fill(155, 75, 15);
  translate(200, -40, 0);
  rotateY(rot);
  sphere(20);
 
  // Moon
  translate(60, -10, 0);
  fill(60, 15, 0);
  rotateY(rot);
  sphere(10);
 
  popMatrix();
 
  popMatrix();
 
}
[/gn_spoiler]