-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsolar.html
83 lines (69 loc) · 1.61 KB
/
solar.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.country {
stroke: #fff;
stroke-width: .5px;
stroke-linejoin: round;
}
.graticule {
fill: none;
stroke: #000;
stroke-opacity: .3;
stroke-width: .5px;
}
.graticule-outline {
fill: none;
stroke: #333;
stroke-width: 1.5px;
}
text {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 18px;
font-weight: bold;
text-anchor: middle;
}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/d3.geo.projection.v0.min.js"></script>
<script src="http://d3js.org/topojson.v0.min.js"></script>
<script>
var width = 960,
height = 500;
var projection = d3.geo.orthographic()
.clipAngle(90);
var color = d3.scale.category10();
var circle = d3.geo.circle()
.angle(90)
var path = d3.geo.path()
.projection(projection);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("world-50m.json", function(error, world) {
var world = svg.selectAll(".country")
.data(topojson.object(world, world.objects.countries).geometries);
world.enter()
.insert("path", ".graticule")
.attr("class", "country")
.attr("d", path)
.attr("fill", function(d, i) { return color(i); })
function draw() {
world
.transition()
.ease("linear")
.duration(50000)
.attrTween("d", function(d) {
var rotate = d3.interpolate([0, 0], [3000, -360]);
return function(t) {
projection.rotate(rotate(t));
return path(d);
}
})
.each("end", draw);
}
draw();
});
</script>
</body>