/
index.html
98 lines (87 loc) · 2.42 KB
/
index.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
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Meetup Distribution Globe</title>
<meta charset="utf-8">
<style type="text/css">
html {
height: 100%;
}
body {
margin: 0;
padding: 0;
background: #000000 url(loading.gif) center center no-repeat;
color: #ffffff;
font-family: sans-serif;
font-size: 13px;
line-height: 20px;
height: 100%;
}
#title {
position: absolute;
top: 20px;
width: 270px;
left: 20px;
background-color: rgba(0,0,0,0.2);
border-radius: 3px;
font: 20px Georgia;
padding: 10px;
}
#ce span {
display: none;
}
#ce {
width: 107px;
height: 55px;
display: block;
position: absolute;
bottom: 15px;
left: 20px;
background: url(ce.png);
}
</style>
</head>
<body>
<div id="container"></div>
<div id="title">
Meetup Distribution
</div>
<a id="ce" href="http://www.chromeexperiments.com/globe">
<span>This is a Chrome Experiment</span>
</a>
<script type="text/javascript" src="third-party/Detector.js"></script>
<script type="text/javascript" src="third-party/three.min.js"></script>
<script type="text/javascript" src="globe.js"></script>
<script type="text/javascript" src="third-party/Tween.js"></script>
<script type="text/javascript">
if(!Detector.webgl){
Detector.addGetWebGLMessage();
} else {
var container = document.getElementById('container');
var globe = new DAT.Globe(container, { imgDir: './' });
var settime = function(globe, t) {
return function() {
new TWEEN.Tween(globe).to({time: t},500).easing(TWEEN.Easing.Cubic.EaseOut).start();
};
};
TWEEN.start();
var xhr = new XMLHttpRequest();
xhr.open('GET', 'data.json', true);
xhr.onreadystatechange = function(e) {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var data = JSON.parse(xhr.responseText);
window.data = data;
globe.addData(data, {format: 'magnitude', name: 'Meetup', animated: true});
globe.createPoints();
settime(globe,0)();
globe.animate();
document.body.style.backgroundImage = 'none';
}
}
};
xhr.send(null);
}
</script>
</body>
</html>