【发布时间】:2021-05-25 22:02:35
【问题描述】:
有没有人花时间从 Cesium 应用程序中提取时间线小部件?我希望使用没有 Dojo 依赖项的时间线小部件。我能够找到一个预告片说这是可能的,但是时间线示例并不是最容易进行逆向工程的。有谁知道我如何提取必要的库并删除 Dojo 依赖项?
【问题讨论】:
标签: javascript cesium
有没有人花时间从 Cesium 应用程序中提取时间线小部件?我希望使用没有 Dojo 依赖项的时间线小部件。我能够找到一个预告片说这是可能的,但是时间线示例并不是最容易进行逆向工程的。有谁知道我如何提取必要的库并删除 Dojo 依赖项?
【问题讨论】:
标签: javascript cesium
时间线本身(在该演示应用程序之外)不使用 Dojo。这是它如何工作的示例。你可以Run this demo on Sandcastle。
function onTimelineScrubfunction(e) {
var clock = e.clock;
clock.currentTime = e.timeJulian;
clock.shouldAnimate = false;
}
var timeControlsContainer = document.getElementById('timeControlsContainer');
var clock = new Cesium.Clock();
var clockViewModel = new Cesium.ClockViewModel(clock);
var animationContainer = document.createElement('div');
animationContainer.className = 'cesium-viewer-animationContainer';
timeControlsContainer.appendChild(animationContainer);
var animation = new Cesium.Animation(animationContainer, new Cesium.AnimationViewModel(clockViewModel));
var timelineContainer = document.createElement('div');
timelineContainer.className = 'cesium-viewer-timelineContainer';
timeControlsContainer.appendChild(timelineContainer);
var timeline = new Cesium.Timeline(timelineContainer, clock);
timeline.addEventListener('settime', onTimelineScrubfunction, false);
timeline.zoomTo(clock.startTime, clock.stopTime);
clockViewModel.shouldAnimate = true;
window.setInterval(function() {
clock.tick();
}, 32);
【讨论】: