I have a task which I want to change the scene mode in Cesium in every interval.
I managed to change the scene mode in every Interval using refresh feature. However, the output is not so nice as it changes quickly. So is it possible to change the scene mode gradually I mean slowly? My code is found below.
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version. -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>Hello World!</title>
<script src="../Build/Cesium/Cesium.js"></script>
<style>
@import url(../Build/Cesium/Widgets/widgets.css);
html, body, #cesiumContainer {
width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
}
</style>
</head>
<body>
<div id="cesiumContainer"></div>
<script type="text/javascript">
var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
scene.mode= Cesium.SceneMode.SCENE3D;
var scenename = "3D";
console.log("Scene Mode 3D");
//updateFromServer();
var intervalID = window.setInterval(updateFromServer, 6000);
function updateFromServer() {
if (scenename === "3D")
{
scene.mode= Cesium.SceneMode.SCENE2D;
scenename = "2D";
console.log("Scene Mode 2D");
}
else
{
scene.mode= Cesium.SceneMode.SCENE3D;
scenename = "3D";
console.log("Scene Mode 3D");
}
}
</script>
</body>
</html>
My code is that by default the scene mode is 3D. I create a variable which is 3D. When it is 3D, it will change to 2D and vice versa.
Can you help me to change the scene mode gradually.