美文网首页开源
Cesium 地球旋转(viewer.scene.camera.

Cesium 地球旋转(viewer.scene.camera.

作者: LBHN | 来源:发表于2019-10-08 13:58 被阅读0次

    //旋转
    viewer.clock.multiplier = 200;//速度
    viewer.clock.shouldAnimate = true;
    var previousTime = viewer.clock.currentTime.secondsOfDay;
    function onTickCallback() {
    var spinRate = 1;
    var currentTime = viewer.clock.currentTime.secondsOfDay;
    var delta = (currentTime - previousTime) / 1000;
    previousTime = currentTime;
    viewer.scene.camera.rotate(Cesium.Cartesian3.UNIT_Z, -spinRate * delta);
    }
    viewer.clock.onTick.addEventListener(onTickCallback);

    //监听点击事件,当点击地图时停止旋转
    var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
    handler.setInputAction(function(click) {
    viewer.clock.onTick.removeEventListener(onTickCallback);
    }, Cesium.ScreenSpaceEventType.LEFT_DOWN);

    相关文章

      网友评论

        本文标题:Cesium 地球旋转(viewer.scene.camera.

        本文链接:https://www.haomeiwen.com/subject/bjejuctx.html