earthjs
Version:
D3 Earth JS using SVG, Canvas & THREE js, build with some plugins.
40 lines (39 loc) • 1.49 kB
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/topojson.min.js"></script>
<script type='text/javascript' src='../js/earthjs.js'></script>
<style>
#three-js {
pointer-events: all;
}
</style>
</head>
<body>
<svg id="earth-js" class="ej-center" width="420" height="420"></svg>
<canvas id="three-js" class="ej-center"></canvas>
<script>
const g = earthjs({
rotate:[47.29637916005367, -2.050804868735837, 1.2794284579135258],
scale:120,
})
.register(earthjs.plugins.inertiaPlugin())
.register(earthjs.plugins.dropShadowSvg())
.register(earthjs.plugins.threejsPlugin())
.register(earthjs.plugins.autorotatePlugin())
.register(earthjs.plugins.globeThreejs('../globe/world_1.jpg'))
.register(earthjs.plugins.worldThreejs('../d/world-110m.json'))
.register(earthjs.plugins.flightLineThreejs('../data/flights2.json','../globe/point3.png'),'flightThreejs')
g.inertiaPlugin.selectAll('#three-js');
g.flightThreejs.ready = function(err, csv) {
g.flightThreejs.data(csv, true, [30,60],55,1);
}
g.ready(function(){
g.create();
})
</script>
</body>
</html>