forked from blockchain/unused-My-Wallet
-
Notifications
You must be signed in to change notification settings - Fork 2
/
bitcoin-globe.js
41 lines (35 loc) · 1.23 KB
/
bitcoin-globe.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
if (!Detector.webgl) {
Detector.addGetWebGLMessage();
} else {
var container = document.getElementById('container');
var globe = new DAT.Globe(container);
console.log(globe);
var i, tweens = [];
function getData(series) {
var xhr;
TWEEN.start();
xhr = new XMLHttpRequest();
xhr.open('GET', root + 'nodes-globe?json=' + series, true);
xhr.onreadystatechange = function(e) {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var data = JSON.parse(xhr.responseText);
window.data = data;
var i = 0;
for (i = 0; i < data.length; i++) {
globe.addData(data[i][1], {
format : 'magnitude',
name : data[i][0],
animated : true
});
}
new TWEEN.Tween(globe).to({time: 0},500).easing(TWEEN.Easing.Cubic.EaseOut).start();
globe.createPoints();
globe.animate();
}
}
};
xhr.send(null);
}
getData($(document.body).data('series'));
}