Appearance
KBE3D / KBCore / Cesium / Animation
类: Animation
<span style="display: block; text-align: center;"> <img src="/Images/AnimationWidget.png" width="211" height="142" alt="" /> <br />Animation widget </span> <br /><br /> The Animation widget provides buttons for play, pause, and reverse, along with the current time and date, surrounded by a "shuttle ring" for controlling the speed of animation. <br /><br /> The "shuttle ring" concept is borrowed from video editing, where typically a "jog wheel" can be rotated to move past individual animation frames very slowly, and a surrounding shuttle ring can be twisted to control direction and speed of fast playback. Cesium typically treats time as continuous (not broken into pre-defined animation frames), so this widget offers no jog wheel. Instead, the shuttle ring is capable of both fast and very slow playback. Click and drag the shuttle ring pointer itself (shown above in green), or click in the rest of the ring area to nudge the pointer to the next preset speed in that direction. <br /><br /> The Animation widget also provides a "realtime" button (in the upper-left) that keeps animation time in sync with the end user's system clock, typically displaying "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.
示例
ts
// 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);参数
The DOM element or ID that will contain the widget.
参数
The view model used by this widget.
属性
container
readonlycontainer:Element
Gets the parent container.
viewModel
readonlyviewModel:AnimationViewModel
Gets the view model.
方法
isDestroyed()
isDestroyed():
boolean
返回
boolean
true if the object has been destroyed, false otherwise.
destroy()
destroy():
void
Destroys the animation widget. Should be called if permanently removing the widget from layout.
返回
void
resize()
resize():
void
Resizes the widget to match the container size. This function should be called whenever the container size is changed.
返回
void
applyThemeChanges()
applyThemeChanges():
void
Updates the widget to reflect any modified CSS rules for theming.
返回
void
示例
ts
//Switch to the cesium-lighter theme.
document.body.className = 'cesium-lighter';
animation.applyThemeChanges();构造函数
构造函数
new Animation(
container:string|Element,viewModel:AnimationViewModel):Animation
参数
container
string | Element
viewModel
返回
Animation
