new Cesium.Clock(options)

用于跟踪模拟时间的简单时钟.
Name Type Description
options object optional 下列属性的对象 :
Name Type Default Description
startTime JulianDate optional 钟的起始时间.
stopTime JulianDate optional 钟的停机时间.
currentTime JulianDate optional 今时.
multiplier number 1.0 optional Determines how much time advances when Clock#tick is called, negative values allow for advancing backwards.
clockStep ClockStep ClockStep.SYSTEM_CLOCK_MULTIPLIER optional Determines if calls to Clock#tick are frame dependent or system clock dependent.
clockRange ClockRange ClockRange.UNBOUNDED optional Determines how the clock should behave when Clock#startTime or Clock#stopTime is reached.
canAnimate boolean true optional Indicates whether Clock#tick can advance time. This could be false if data is being buffered, for example. The clock will only tick when both Clock#canAnimate and Clock#shouldAnimate are true.
shouldAnimate boolean false optional Indicates whether Clock#tick should attempt to advance time. The clock will only tick when both Clock#canAnimate and Clock#shouldAnimate are true.
Throws:
Example:
// Create a clock that loops on Christmas day 2013 and runs in real-time.
const clock = new Cesium.Clock({
   startTime : Cesium.JulianDate.fromIso8601("2013-12-25"),
   currentTime : Cesium.JulianDate.fromIso8601("2013-12-25"),
   stopTime : Cesium.JulianDate.fromIso8601("2013-12-26"),
   clockRange : Cesium.ClockRange.LOOP_STOP,
   clockStep : Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER
});
See:

Members

canAnimate : boolean

Indicates whether Clock#tick can advance time. This could be false if data is being buffered, 举个例子 时钟只会提前时间 Clock#canAnimate and Clock#shouldAnimate are true.
Default Value: true

clockRange : ClockRange

确定时钟应如何表现 Clock#startTime or Clock#stopTime is reached.
Default Value: ClockRange.UNBOUNDED

clockStep : ClockStep

Determines if calls to Clock#tick are frame dependent or system clock dependent. Changing this property to ClockStep.SYSTEM_CLOCK will set Clock#multiplier to 1.0, Clock#shouldAnimate to true, and Clock#currentTime to the current system clock time.
Default Value: ClockStep.SYSTEM_CLOCK_MULTIPLIER

currentTime : JulianDate

multiplier : number

Gets or sets how much time advances when Clock#tick is called. Negative values allow for advancing backwards. If Clock#clockStep is set to ClockStep.TICK_DEPENDENT, this is the number of seconds to advance. If Clock#clockStep is set to ClockStep.SYSTEM_CLOCK_MULTIPLIER, this value is multiplied by the elapsed system time since the last call to Clock#tick. 更改此属性将更改 Clock#clockStep from ClockStep.SYSTEM_CLOCK to ClockStep.SYSTEM_CLOCK_MULTIPLIER.
Default Value: 1.0

onStop : Event

An Event that is fired whenever Clock#stopTime is reached.

onTick : Event

An Event that is fired whenever Clock#tick is called.

shouldAnimate : boolean

Indicates whether Clock#tick should attempt to advance time. 时钟只会提前时间 Clock#canAnimate and Clock#shouldAnimate are true. 更改此属性将更改 Clock#clockStep from ClockStep.SYSTEM_CLOCK to ClockStep.SYSTEM_CLOCK_MULTIPLIER.
Default Value: false

startTime : JulianDate

钟的起始时间.

stopTime : JulianDate

钟的停机时间.

Methods

tick()JulianDate

根据当前配置选项将时钟从当前时间提前. 无论动画是否正在发生, 勾选应当调用每个帧 or not. To control animation, use the Clock#shouldAnimate property.
Returns:
The new value of the Clock#currentTime property.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.