A simple clock for keeping track of simulated time.
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
optional
Object with the following properties:
|
Throws:
-
DeveloperError : startTime must come before stopTime.
Example:
// Create a clock that loops on Christmas day 2013 and runs in real-time.
var 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
-
Indicates whether
Clock#tickcan advance time. This could be false if data is being buffered, for example. The clock will only advance time when bothClock#canAnimateandClock#shouldAnimateare true.-
Default Value:
true -
clockRange : ClockRange
-
Determines how the clock should behave when
Clock#startTimeorClock#stopTimeis reached.-
Default Value:
ClockRange.UNBOUNDED -
clockStep : ClockStep
-
Determines if calls to
Clock#tickare frame dependent or system clock dependent. Changing this property toClockStep.SYSTEM_CLOCKwill setClock#multiplierto 1.0,Clock#shouldAnimateto true, andClock#currentTimeto the current system clock time.-
Default Value:
ClockStep.SYSTEM_CLOCK_MULTIPLIER -
currentTime : JulianDate
-
The current time. Changing this property will change
Clock#clockStepfromClockStep.SYSTEM_CLOCKtoClockStep.SYSTEM_CLOCK_MULTIPLIER. -
Gets or sets how much time advances when
Clock#tickis called. Negative values allow for advancing backwards. IfClock#clockStepis set toClockStep.TICK_DEPENDENT, this is the number of seconds to advance. IfClock#clockStepis set toClockStep.SYSTEM_CLOCK_MULTIPLIER, this value is multiplied by the elapsed system time since the last call toClock#tick. Changing this property will changeClock#clockStepfromClockStep.SYSTEM_CLOCKtoClockStep.SYSTEM_CLOCK_MULTIPLIER.-
Default Value:
1.0 -
onTick : Event
-
An
Eventthat is fired wheneverClock#tickis called. -
Indicates whether
Clock#tickshould attempt to advance time. The clock will only advance time when bothClock#canAnimateandClock#shouldAnimateare true. Changing this property will changeClock#clockStepfromClockStep.SYSTEM_CLOCKtoClockStep.SYSTEM_CLOCK_MULTIPLIER.-
Default Value:
true -
startTime : JulianDate
-
The start time of the clock.
-
stopTime : JulianDate
-
The stop time of the clock.
Methods
-
tick() → JulianDate
-
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#shouldAnimateproperty.Returns:
The new value of theClock#currentTimeproperty.
