1. cesium 动画必须开启动画窗格和时间线,通过设置style进行隐藏
javascript
viewer._cesiumWidget._creditContainer.style.display = "none"; // 隐藏cesium ion
viewer.timeline.container.style.display = 'none'; // 隐藏时间线
viewer.animation.container.style.visibility = 'hidden' // 隐藏动画控件
2. 显示系统时间
javascript
var d = new Date();
var hour = 0 - d.getTimezoneOffset();
viewer.animation.viewModel.timeFormatter = function (date, viewModel) {
var dateZone8 = Cesium.JulianDate.addMinutes(date, hour, new Cesium.JulianDate());
var gregorianDate = Cesium.JulianDate.toGregorianDate(dateZone8);
var millisecond = Math.round(gregorianDate.millisecond);
if (Math.abs(viewModel._clockViewModel.multiplier) < 1) {
return Cesium.sprintf("%02d:%02d:%02d.%03d;", gregorianDate.hour, gregorianDate.minute, gregorianDate.second);
}
return Cesium.sprintf("%02d:%02d:%02d GMT+8", gregorianDate.hour, gregorianDate.minute, gregorianDate.second);
};
3. Animation 控件的前进、后退、暂停
javascript
let viewModel = viewer.animation.viewModel;
let command
if ("后退") {
command = viewModel.playReverseViewModel.command;
} else if ("暂停/播放"){
command = viewModel.pauseViewModel.command;
} else if("前进") {
command = viewModel.playForwardViewModel.command
}
if (command.canExecute) {
command()
}