-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathicosahedron-arcs-3061181.html
60 lines (46 loc) · 1.08 KB
/
icosahedron-arcs-3061181.html
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
<!DOCTYPE html>
<meta charset="utf-8">
<style>
path {
fill: none;
stroke: #000;
}
circle {
fill: none;
stroke: #000;
stroke-width: 3px;
}
</style>
<body>
<script src="http://d3js.org/d3.v2.min.js?2.9.6"></script>
<script src="geodesic.js"></script>
<script>
var width = 960,
height = 500;
var origin = [0, 0],
velocity = [-.01, .01],
t0 = Date.now();
var projection = d3.geo.azimuthal()
.mode("orthographic")
.origin(origin)
.scale(240);
var circle = d3.geo.circle()
.origin(origin);
var path = d3.geo.path()
.projection(projection);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
svg.append("path")
.datum(d3.geodesic.multipolygon(1));
svg.append("circle")
.attr("transform", "translate(" + projection(origin) + ")")
.attr("r", 240);
d3.timer(function() {
var t = Date.now() - t0,
o = [origin[0] + t * velocity[0], origin[1] + t * velocity[1]];
projection.origin(o);
circle.origin(o);
svg.selectAll("path").attr("d", function(d) { return path(circle.clip(d)); });
});
</script>