UNPKG

earthjs

Version:

D3 Earth JS using SVG, Canvas & THREE js, build with some plugins.

61 lines (60 loc) 2.23 kB
<!DOCTYPE html> <html> <head> <link type="text/css" rel="stylesheet" href="../css/earthjs.css"> <script type='text/javascript' src="../js/d3.min.js"></script> <script type='text/javascript' src='../js/three.min.js'></script> <script type='text/javascript' src='../js/threex.domevents.js'></script> <script type='text/javascript' src="../js/topojson.min.js"></script> <script type='text/javascript' src='../js/earthjs.js'></script> <style> body { background: #555; } #three-js { pointer-events: all; } </style> </head> <body> <svg id="earth-js" class="ej-center"></svg> <canvas id="three-js" class="ej-center"></canvas> <script type='text/javascript' src='./flightline.js'></script> <script> g.register(earthjs.plugins.colorScale([1,1000000])) .register(earthjs.plugins.worldJson('../d/world-110m.json')) .register(earthjs.plugins.globeThreejs('../globe/world_texture_1.jpg')) .register(earthjs.plugins.worldThreejs('../d/world-110m.json')) .register(earthjs.plugins.flightLineThreejs('../data/flights2.json','../globe/point3.png')) .register(earthjs.plugins.iconsThreejs('../data/bars.json','../globe/check.svg')) .register(earthjs.plugins.barThreejs()); g.inertiaPlugin.selectAll('#three-js'); g.iconsThreejs.ready = function(err, json) { json.features.forEach(function(d) { d.geometry.value = d.properties.mag; }); g.iconsThreejs.data(json); g.barThreejs.data(json); }; g.flightLineThreejs.ready = function(err, csv) { g.flightLineThreejs.data(csv, ['#aaffff','#ff0011'],[30,200],100,1); } g.flightLineThreejs.onHover({ checkLine(event) { console.log('checkLine') } }) g.globeThreejs.onHover({ checkLine(event) { console.log('checkOutside'); } }) g.worldJson.ready = function(err, json) { g.clickCanvas.data(json); } g.ready(function(){ g.create(); }) </script> </body> </html>