12. cesium中的Animation

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()
}
相关推荐
AI前端工程狮1 分钟前
我把 MCP 长任务拆成三个工具,token 账单涨了 7 倍
javascript·人工智能·程序员
mONESY20 分钟前
DeepAgents 从零上手:别再手搓 Harness,用中间件拼出一个调研团队
javascript
吴长建先生重名了34 分钟前
一次线上MySQL慢查询Bug的复现与调优全过程
javascript
LVZ2 小时前
AI Agent 缺的不是更强的模型,而是一个运行时
前端·javascript·后端
1-1=03 小时前
Vue 中 Class 与 Style 绑定
前端·javascript·vue.js
用户83134859306983 小时前
Vue3的v-if /v-show/v-else /v-else-if:区别、渲染原理、坑点与性能选型
前端·javascript·vue.js
mONESY3 小时前
LangSmith 全链路观测:从 Agent 调试到 RAG 量化评估
javascript
NoteDeep 深度笔记5 小时前
DOM 被改乱了怎么办?Notedeep 编辑器的 normalize 设计
前端·javascript·编辑器
翼帆7 小时前
我用 AI 复刻了 CodeTank,重温代码坦克
前端·javascript·开源·ai编程·游戏开发·codetank
黑土豆8 小时前
用 drawink 给业务页面加一层画板:从网页批注到无限板书
前端·javascript·github