-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplanet_shadows.js
62 lines (47 loc) · 1.24 KB
/
planet_shadows.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
(function () {
let w = 400,
h = 350;
let sim = new Sim("#planet_shadows", h, w);
let atmosGradient = sim.svg.append("defs").append("radialGradient")
.attrs({
id: "atmosGradient"
})
atmosGradient.append("stop").attrs({
offset: "0%",
"stop-color": "rgba(155, 192, 241, 1)"
})
atmosGradient.append("stop").attrs({
offset: "98%",
"stop-color": "rgba(155, 192, 241, 0)"
})
let atmos_c = new Circle(w / 2, h / 2 - 70, 55);
let atmos = sim.add_circle(atmos_c, {
style: "solid atmos",
refractive: true,
ior: 1.15
})
let planet_c = new Circle(w / 2, h / 2 - 70, 35);
let planet = sim.add_circle(planet_c, {
style: "solid moon"
})
let beam = new ConeLamp({
x: 20,
y: 3 * h / 4,
width: Math.PI / 4,
num_rays: 30,
angle: 0,
handle_gap: 60,
ui: {}
})
let moon_c = new Circle(w / 2, h / 2 + 70, 35);
sim.add_circle(moon_c, {
style: "solid moon"
})
sim.add_light(beam);
sim.svg.append("text")
.attrs({
x: w/2,
y: h - 20,
"text-anchor": "middle"
}).text("NOT TO SCALE")
})();