English中文

Clock

new Cesium.Clock(options)

一个简单的时钟,用于跟踪模拟时间。 A simple clock for keeping track of simulated time.
名称 Name 类型 Type 说明 Description
options object 可选 optional 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 默认值 Default 说明 Description
startTime JulianDate 可选 optional 时钟的开始时间。 The start time of the clock.
stopTime JulianDate 可选 optional 时钟的停止时间。 The stop time of the clock.
currentTime JulianDate 可选 optional 当前时间。 The current time.
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:
  • DeveloperError :startTime 必须在 stopTime 之前。 : startTime must come before stopTime.
示例: 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, for example. The clock will only advance time when both Clock#canAnimate and Clock#shouldAnimate 是真的。 are true.
默认值: Default Value: true
确定时钟在以下情况下应如何表现 Determines how the clock should behave when Clock#startTime or Clock#stopTime 已达到。 is reached.
默认值: Default Value: ClockRange.UNBOUNDED
确定是否调用 Determines if calls to Clock#tick 取决于帧或系统时钟。将此属性更改为 are frame dependent or system clock dependent. Changing this property to ClockStep.SYSTEM_CLOCK 将设置 will set Clock#multiplier 到 1.0, to 1.0, Clock#shouldAnimate 为真,并且 to true, and Clock#currentTime 到当前系统时钟时间。 to the current system clock time.
默认值: Default Value: ClockStep.SYSTEM_CLOCK_MULTIPLIER
当前时间。改变这个属性将会改变 The current time. Changing this property will change Clock#clockStep from ClockStep.SYSTEM_CLOCK to ClockStep.SYSTEM_CLOCK_MULTIPLIER.

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。改变这个属性将会改变 . Changing this property will change Clock#clockStep from ClockStep.SYSTEM_CLOCK to ClockStep.SYSTEM_CLOCK_MULTIPLIER.
默认值: Default Value: 1.0
An Event 每当 that is fired whenever Clock#stopTime 已达到。 is reached.
An Event 每当 that is fired whenever Clock#tick 被称为。 is called.

shouldAnimate : boolean

表示是否 Indicates whether Clock#tick 应尝试提前时间。只有当两者都存在时,时钟才会提前时间 should attempt to advance time. The clock will only advance time when both Clock#canAnimate and Clock#shouldAnimate 是真的。改变这个属性将会改变 are true. Changing this property will change Clock#clockStep from ClockStep.SYSTEM_CLOCK to ClockStep.SYSTEM_CLOCK_MULTIPLIER.
默认值: Default Value: false
时钟的开始时间。 The start time of the clock.
时钟的停止时间。 The stop time of the clock.

方法 Methods

根据当前配置选项将时钟从当前时间提前。无论动画是否正在发生,都应该在每一帧调用tick。要控制动画,请使用 Advances the clock from the current time based on the current configuration options. tick should be called every frame, regardless of whether animation is taking place 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.