72 lines
1.7 KiB
JavaScript
72 lines
1.7 KiB
JavaScript
import { Cartesian3, EasingFunction, Math } from "cesium";
|
|
import { useCesium } from "resium";
|
|
|
|
function CustomFlyTo() {
|
|
const { viewer } = useCesium();
|
|
const { camera } = viewer;
|
|
|
|
function cameraFlyToLine() {
|
|
const step1 = {
|
|
destination: Cartesian3.fromDegrees(-10, 50, 6000000),
|
|
duration: 5,
|
|
complete: () => {
|
|
camera.flyTo(step2);
|
|
},
|
|
easingFunction: EasingFunction.LINEAR_NONE,
|
|
};
|
|
|
|
const step2 = {
|
|
destination: Cartesian3.fromDegrees(35, 49, 10000000),
|
|
duration: 8,
|
|
complete: () => {
|
|
camera.flyTo(barotorpic);
|
|
},
|
|
easingFunction: EasingFunction.LINEAR_NONE,
|
|
};
|
|
|
|
// barotorpic
|
|
const barotorpic = {
|
|
destination: Cartesian3.fromDegrees(60, 15, 15000000),
|
|
duration: 7,
|
|
complete: () => {},
|
|
easingFunction: EasingFunction.LINEAR_NONE,
|
|
orientation: {
|
|
heading: 6.283,
|
|
pitch: -1.4,
|
|
roll: 0,
|
|
},
|
|
};
|
|
|
|
// 俯视看箭头上升
|
|
const sideViewOptions = {
|
|
destination: Cartesian3.fromDegrees(-50, 42, 2200000),
|
|
duration: 5,
|
|
orientation: {
|
|
heading: Math.toRadians(-15.0),
|
|
pitch: -Math.PI_OVER_FOUR,
|
|
roll: 0.0,
|
|
},
|
|
// destination: Cartesian3.fromDegrees(-50, 46, 2200000),
|
|
// duration: 5,
|
|
// orientation: {
|
|
// heading: Math.toRadians(-15.0),
|
|
// pitch: -Math.PI_OVER_FOUR,
|
|
// roll: 0.0,
|
|
// },
|
|
complete: () => {
|
|
viewer.clock.shouldAnimate = true;
|
|
setTimeout(function () {
|
|
camera.flyTo(step1);
|
|
}, 5000);
|
|
},
|
|
};
|
|
|
|
camera.flyTo(sideViewOptions);
|
|
}
|
|
cameraFlyToLine();
|
|
|
|
return <></>;
|
|
}
|
|
|
|
export default CustomFlyTo;
|