<!DOCTYPE html> <html> <head> <meta charset='UTF-8'/> <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no'/> <link href='http://bigemap.com:9000/bigemap-gl.js/v1.1.0/Widgets/widgets.css' rel='stylesheet'/> <script src='http://bigemap.com:9000/bigemap-gl.js/v1.1.0/bigemap-gl.js'></script> <style> body { margin: 0; padding: 0; } #container { position: absolute; top: 0; bottom: 0; width: 100%; } .bmgl-widget-credits{display:none} </style> <title>part_test</title> </head> <body> <div id='container'></div> <script> bmgl.Config.HTTP_URL = 'http://bigemap.com:9000'; var viewer = new bmgl.Viewer('container', { // terrainId: 'bigemap.9af15d8e', timeline:true, animation:true, mapId: 'bigemap.zhongkexingtu' }); var a = viewer.clock.currentTime.secondsOfDay; rotateEventListener = function (e) { var i = viewer.clock.currentTime.secondsOfDay, t = ((i - a) / 1e3) * 0.4; a = i; viewer.scene.camera.rotate(bmgl.Cartesian3.UNIT_Z, 1 * t) }; viewer.clock.multiplier = 200; viewer.clock.shouldAnimate = true; viewer.clock.onTick.addEventListener(rotateEventListener); viewer.camera.changed.addEventListener(function () { var p=bmgl.Cartographic.fromCartesian(viewer.camera.position); if(p.height<1200000){ //相机视角高高低于1200000,将不再旋转 if (rotateEventListener){ viewer.clock.onTick.removeEventListener(rotateEventListener); rotateEventListener=null; } }; }); </script> </body> </html>
源码