UNPKG

globe.gl

Version:

UI component for Globe Data Visualization using ThreeJS/WebGL

31 lines (26 loc) 996 B
<head> <style> body { margin: 0; } </style> <script src="//cdn.jsdelivr.net/npm/globe.gl"></script> <!--<script src="../../dist/globe.gl.js"></script>--> </head> <body> <div id="globeViz"></div> <script> // Gen random data const N = 20; const arcsData = [...Array(N).keys()].map(() => ({ startLat: (Math.random() - 0.5) * 180, startLng: (Math.random() - 0.5) * 360, endLat: (Math.random() - 0.5) * 180, endLng: (Math.random() - 0.5) * 360, color: [['red', 'white', 'blue', 'green'][Math.round(Math.random() * 3)], ['red', 'white', 'blue', 'green'][Math.round(Math.random() * 3)]] })); new Globe(document.getElementById('globeViz')) .globeImageUrl('//cdn.jsdelivr.net/npm/three-globe/example/img/earth-night.jpg') .arcsData(arcsData) .arcColor('color') .arcDashLength(() => Math.random()) .arcDashGap(() => Math.random()) .arcDashAnimateTime(() => Math.random() * 4000 + 500); </script> </body>