new Clock
A simple clock for keeping track of simulated time.
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
template |
Object |
<optional> |
The template object containing the properties to be set on the clock. |
Throws:
DeveloperError
: startTime must come before stopTime.
Example
//Create a clock that loops on Christmas day 2012 and runs
//in real-time. currentTime will default to startTime.
var clock = new Clock({
startTime : JulianDate.fromIso8601("12-25-2012");
stopTime : JulianDate.fromIso8601("12-26-2012");
clockRange : ClockRange.LOOP;
});
Members
-
clockRange :ClockRange
-
Determines how tick should behave when
startTimeorstopTimeis reached. -
clockStep :ClockStep
-
Determines if calls to
tickare frame dependent or system clock dependent. -
currentTime :JulianDate
-
The current time.
-
multiplier :Number
-
Determines how much time advances when tick is called, negative values allow for advancing backwards. If
clockStepis set to ClockStep.TICK_DEPENDENT this is the number of seconds to advance. IfclockStepis set to ClockStep.SYSTEM_CLOCK_DEPENDENT this value is multiplied by the elapsed system time since the last call to tick. -
startTime :JulianDate
-
The start time of the clock.
-
stopTime :JulianDate
-
The stop time of the clock.
Methods
-
reverseTick
-
Advances the clock in the opposite direction of the current
multiplier. Ifmultiplieris positive this will advance the clock backwards one tick. Ifmultiplieris negative this will advance the clock forward one tick.Returns:
JulianDate The new value of Clock.currentTime -
tick
-
Advances the clock from the currentTime based on the current configuration options.
Parameters:
Name Type Argument Description secondsToTickNumber <optional>
optional parameter to force the clock to tick the provided number of seconds, regardless of the value of clockStepandmultiplier.Returns:
JulianDate The new value of thecurrentTimeproperty.
