首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

Planetary.js 旋转地球插件

(function() { var canvas = document.getElementById('quakeCanvas'); // Create our Planetary.js planet and set some initial values; // we use several custom plugins, defined at the bottom of the file var planet = planetaryjs.planet(); planet.loadPlugin(autocenter({extraHeight: -120})); planet.loadPlugin(autoscale({extraHeight: -120})); planet.loadPlugin(planetaryjs.plugins.earth({ topojson: { file: 'https://101.43.39.125/HexoFiles/js/planetaryjs/world-110m.json' }, oceans: { fill: '#001320' }, land: { fill: '#06304e' }, borders: { stroke: '#001320' } })); planet.loadPlugin(planetaryjs.plugins.pings()); planet.loadPlugin(planetaryjs.plugins.zoom({ scaleExtent: [50, 5000] })); planet.loadPlugin(planetaryjs.plugins.drag({ onDragStart: function() { this.plugins.autorotate.pause(); }, onDragEnd: function() { this.plugins.autorotate.resume(); } })); planet.loadPlugin(autorotate(5)); planet.projection.rotate([100, -10, 0]); planet.draw(canvas); // Plugin to resize the canvas to fill the window and to // automatically center the planet when the window size changes function autocenter(options) { options = options || {}; var needsCentering = false; var globe = null; var resize = function() { var width = window.outerWidth /2 + (options.extraWidth || 0); var height = window.outerHeight/2 + (options.extraHeight || 0); globe.canvas.width = width; globe.canvas.height = height; globe.projection.translate([width / 2, height / 2]); }; return function(planet) { globe = planet; planet.onInit(function() { needsCentering = true; d3.select(window).on('resize', function() { needsCentering = true; }); }); planet.onDraw(function() { if (needsCentering) { resize(); needsCentering = false; } }); }; }; // Plugin to automatically scale the planet's projection based // on the window size when the planet is initia

03

Node.js学习入门

Node.js是一个可以允许我们在服务器端运行JavaScript代码的程序。 这是什么意思呢?通常,我们写的JavaScript代码都是在浏览器中运行的。 实际上,浏览器就是一个JavaScript运行时环境,用于解释执行js代码。 更进一步地说,虽然浏览器提供了JavaScript运行时环境,但是它处在客户端,也就是说此时JavaScript只能用于编写前端代码。 但是,由于Node.js的出现,JavaScript代码的执行就不会被局限于在客户端,我们同样可以让JavaScript代码在服务端执行。 OK,也就是说,即便你不懂任何服务端编程语言,但是你会写JavaScript代码,那么你就同样可以编写在服务端运行的程序。 注意:虽然我们可以使用Node.js运行js代码,但是Node.js本身却是C语言开发的!

04
领券