Cesium-Examples/examples/cesiumEx/1.5、相机.html
2025-06-12 14:10:21 +08:00

108 lines
4.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--********************************************************************
* by jiawanlong
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="./../../libs/cesium/Cesium1.98/Widgets/widgets.css">
<script type="text/javascript" src="./../../libs/cesium/Cesium1.98/Cesium.js"></script>
</head>
<body style="margin: 0; overflow: hidden; background: #fff; width: 100%; height: 100%; position: absolute; top: 0">
<div id="map" style="margin: 0 auto; width: 100%; height: 100%"></div>
<script type="text/javascript">
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyMjBhMzcxMC0wNjBiLTRmYjItYjY1MC0wMzAwMzMyMGUyMmEiLCJpZCI6MzAzNzc3LCJpYXQiOjE3NDc2Mzk0NTV9.E_90aKtVdzRGlU2z48VwJ4mWvl-uuDkfQBCOO6zbzn4'
const viewer = new Cesium.Viewer('map', {});
// 开启帧率
viewer.scene.debugShowFramesPerSecond = true;
// flyTo和setView
// ------------------flyTo--------------
viewer.camera.flyTo({
//destination : Cesium.Rectangle.fromDegrees(west, south, east, north),
destination: Cesium.Cartesian3.fromDegrees(110.511154, 29.362943, 16531517.4),
// ------------------------------------用这个,不卡顿,否则会在终点卡顿!!!!!!!!--------------------------------------------
easingFunction: Cesium.EasingFunction.LINEAR_NONE,
duration: 5,
orientation: {
heading: Cesium.Math.toRadians(348.3), // 水平旋转围绕Y轴0为正北方向
pitch: Cesium.Math.toRadians(-89.8), // 上下旋转围绕X轴-90为俯视地面
roll: 0.0 // 视口的翻滚角度围绕Z轴0为不翻转
},
complete: () => {
viewer.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(115.585535, 22.016248,
5220342.6),
duration: 5,
easingFunction: Cesium.EasingFunction.LINEAR_NONE,
orientation: {
heading: Cesium.Math.toRadians(
346.4), // east, default value is 0.0 (north)
pitch: Cesium.Math.toRadians(
-79.6), // default value (looking down)
roll: 0.0 // default value
}, complete: () => {
viewer.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(119.441071, 34.651193,
743459.7),
duration: 5,
easingFunction: Cesium.EasingFunction.LINEAR_NONE,
orientation: {
heading: Cesium.Math.toRadians(
346.4), // east, default value is 0.0 (north)
pitch: Cesium.Math.toRadians(
-79.6), // default value (looking down)
roll: 0.0 // default value
}
});
}
});
}
});
//----------- setView----------------------
// 俯视到目的地
// viewer.camera.setView({
// destination: Cesium.Cartesian3.fromDegrees(-117.16, 32.71, 15000.0)
// });
// latlng.getCameraView(viewer)
// // 目的地带方向
// viewer.camera.setView({
// destination: Cesium.Cartesian3.fromDegrees(-117.16, 32.71, 15000.0),
// orientation: {
// heading: Cesium.Math.toRadians(90.0), // east, default value is 0.0 (north)
// pitch: Cesium.Math.toRadians(-90), // default value (looking down)
// roll: 0.0 // default value
// }
// });
viewer.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(85.788705, 15.165394, 3013490),
orientation: {
heading: Cesium.Math.toRadians(27.7), // east, default value is 0.0 (north)
pitch: Cesium.Math.toRadians(-67.7), // default value (looking down)
roll: 0.0 // default value
}
});
// // 只跳转方向
// viewer.camera.setView({
// orientation: {
// heading: Cesium.Math.toRadians(90.0), // east, default value is 0.0 (north)
// pitch: Cesium.Math.toRadians(-90), // default value (looking down)
// roll: 0.0 // default value
// }
// });
</script>
</body>
</html>