new Cesium.Animation(container, viewModel)

NT 0 动画部件

动画部件提供了播放、暂停和反向的按钮,以及 当前的时间和日期,周围是用于控制动画速度的"shuttle ring".

"shuttle ring"的概念是从视频编辑中借来的,其中典型的是一个 "jog wheel"可以旋转,以非常缓慢地移动过去的个人动画帧,以及 周围的航天飞机环可扭曲,以控制快速回放的方向和速度. Cesium 通常将时间视为连续时间(不突破为预定义的动画框), 所以这个部件不会提供慢跑轮。 相反,太空梭环 能够快速和 非常缓慢的回放。 单击并拖动穿梭环指针本身(上方为绿色), 或单击环状区域的其他部分,使指针向该方向向下一个预设速度倾斜.

动画部件还提供了保留“实时”按钮(在左上方) 动画时间与终端用户的系统时钟同步, 通常显示 "today" or "right now." This mode is not available in ClockRange.CLAMPED or ClockRange.LOOP_STOP mode if the current time is outside of Clock's startTime and endTime.
Name Type Description
container Element | string The DOM element or ID that will contain the widget.
viewModel AnimationViewModel 此部件使用的视图模式 .
Throws:
  • DeveloperError : Element with id "container" does not exist in the document.
Example:
// In HTML head, include a link to Animation.css stylesheet,
// and in the body, include: <div id="animationContainer"></div>

const clock = new Cesium.Clock();
const clockViewModel = new Cesium.ClockViewModel(clock);
const viewModel = new Cesium.AnimationViewModel(clockViewModel);
const widget = new Cesium.Animation('animationContainer', viewModel);

function tick() {
    clock.tick();
    requestAnimationFrame(tick);
}
requestAnimationFrame(tick);
See:

Members

readonly container : Element

得到母容器.

readonly viewModel : AnimationViewModel

获得观音模型.

Methods

applyThemeChanges()

更新部件以反映修改过的 NT 0 规则.
Example:
//Switch to the cesium-lighter theme.
document.body.className = 'cesium-lighter';
animation.applyThemeChanges();

destroy()

摧毁动画部件。 如果永久调用, 应该调用 从布局中删除部件 .

isDestroyed()boolean

Returns:
如果物体已被销毁, 则真实无误 .

resize()

调整部件大小以匹配容器大小. 当容器大小改变时,该函数就应当调用.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.