//旋转
viewer.clock.multiplier = 200;
viewer.clock.shouldAnimate = true;
let previousTime = viewer.clock.currentTime.secondsOfDay;
function onTickCallback() {
const spinRate = 1;
const currentTime = viewer.clock.currentTime.secondsOfDay;
const delta = (currentTime - previousTime) / 1000;
previousTime = currentTime;
viewer.scene.camera.rotate(Cesium.Cartesian3.UNIT_Z, -spinRate * delta);
}
viewer.clock.onTick.addEventListener(onTickCallback);
//监听点击事件,当点击地图时停止旋转
const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction((click)=> {
viewer.clock.onTick.removeEventListener(onTickCallback);
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);