-
Notifications
You must be signed in to change notification settings - Fork 0
/
sketch.js
45 lines (38 loc) · 844 Bytes
/
sketch.js
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
45
var path = [];
var angle = 0.0;
var resolution = 50;
var sun;
var end;
function setup(){
createCanvas(600,600);
sun = new Orbit(width/2, height/2, width/4, 0);
var next = sun;
for (var i = 0; i < 10; i++) {
next = next.addChild();
}
end = next;
}
function draw(){
background(51);
for (var i = 0; i < resolution; i++) {
next = sun;
while (next != null) {
next.update();
next = next.child;
}
path.push(createVector(end.x, end.y));
}
next = sun;
while (next != null) {
next.show();
next = next.child;
}
beginShape();
stroke(255, 0, 255);
noFill();
for (var i = 0; i < path.length; i++){
pos = path[i];
vertex(pos.x, pos.y);
}
endShape();
}