-
Notifications
You must be signed in to change notification settings - Fork 0
/
index5.html
121 lines (100 loc) · 2.61 KB
/
index5.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<style type="text/css">
@import url('https://fonts.googleapis.com/css2?family=Geo&family=Oxanium:wght@200&display=swap');
*:before, *:after, *, ::after, ::before {
box-sizing: border-box;
}
body {
display: grid;
background: linear-gradient(#101925, #1f3949);
background-size: cover;
height: 100vh;
padding: 0;
margin: 0;
color: rgba(255, 255, 255, 0.5);
font-family: Oxanium;
font-size: 1.1rem;
align-content: start;
}
canvas {
position: fixed;
right: -32rem;
/* height: 100vh; */
z-index: -1;
}
p {margin: 1rem; color: white; font-size: 2rem;}
h3 {
text-transform: uppercase;
margin: 1rem;
}
h3::before {
content: 'CSS.Garden';
position: absolute;
color: rgba(102,175,233,0.5);
font-size: 5rem;
word-break: break-word;
}
</style>
</head>
<body>
<h3></h3>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="https://d3js.org/topojson.v1.min.js"></script>
<script>
var width = 1000,
height = 1000,
speed = -2e-3,
start = Date.now();
var sphere = {type: "Sphere"};
var projection = d3.geo.orthographic()
.scale(width / 2.1)
.translate([width / 2, height / 2])
.precision(.5);
var graticule = d3.geo.graticule();
var canvas = d3.select("body").append("canvas")
.attr("width", width)
.attr("height", height);
var context = canvas.node().getContext("2d");
var path = d3.geo.path()
.projection(projection)
.context(context);
d3.json("https://s3-us-west-2.amazonaws.com/s.cdpn.io/95802/world-110m.json", function(error, topo) {
if (error) throw error;
var land = topojson.feature(topo, topo.objects.land),
grid = graticule();
d3.timer(function() {
context.clearRect(0, 0, width, height);
projection.rotate([speed * (Date.now() - start), -15]).clipAngle(90);
context.beginPath();
path(sphere);
context.lineWidth = 0;
context.strokeStyle = "rgba(102,175,233,1)";
context.stroke();
context.fillStyle = "rgba(102,175,233,0.0)";
context.fill();
projection.clipAngle(180);
context.beginPath();
path(land);
context.fillStyle = "rgba(102,175,233,0.04)";
context.fill();
context.beginPath();
path(grid);
context.lineWidth = .5;
context.strokeStyle = "rgba(102,175,233,0.3)";
context.stroke();
projection.clipAngle(90);
context.beginPath();
path(land);
context.fillStyle = "rgba(102,175,233,0.1)";
context.fill();
context.lineWidth = 0;
context.strokeStyle = "transparent";
context.stroke();
});
});
d3.select(self.frameElement).style("height", height + "px");
</script>
</body>
</html>