All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.cesium.Clock.kt Maven / Gradle / Ivy

// Automatically generated - do not modify!

@file:JsModule("cesium")

@file:Suppress(
    "NON_EXTERNAL_DECLARATION_IN_INAPPROPRIATE_FILE",
)

package cesium

/**
 * A simple clock for keeping track of simulated time.
 * ```
 * // Create a clock that loops on Christmas day 2013 and runs in real-time.
 * const clock = new Clock({
 *    startTime : JulianDate.fromIso8601("2013-12-25"),
 *    currentTime : JulianDate.fromIso8601("2013-12-25"),
 *    stopTime : JulianDate.fromIso8601("2013-12-26"),
 *    clockRange : ClockRange.LOOP_STOP,
 *    clockStep : ClockStep.SYSTEM_CLOCK_MULTIPLIER
 * });
 * ```
 * @see Online Documentation
 */
external class Clock {
    /**
     * The start time of the clock.
     * @see Online Documentation
     */
    var startTime: JulianDate

    /**
     * The stop time of the clock.
     * @see Online Documentation
     */
    var stopTime: JulianDate

    /**
     * Determines how the clock should behave when
     * [Clock.startTime] or [Clock.stopTime]
     * is reached.
     * @see Online Documentation
     */
    var clockRange: ClockRange

    /**
     * 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.
     * @see Online Documentation
     */
    var canAnimate: Boolean

    /**
     * An [Event] that is fired whenever [Clock.tick] is called.
     * @see Online Documentation
     */
    var onTick: Event

    /**
     * An [Event] that is fired whenever [Clock.stopTime] is reached.
     * @see Online Documentation
     */
    var onStop: Event

    /**
     * The current time.
     * Changing this property will change
     * [Clock.clockStep] from [ClockStep.SYSTEM_CLOCK] to
     * [ClockStep.SYSTEM_CLOCK_MULTIPLIER].
     * @see Online Documentation
     */
    var currentTime: JulianDate

    /**
     * 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].
     * @see Online Documentation
     */
    var multiplier: Double

    /**
     * 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.
     * @see Online Documentation
     */
    var clockStep: ClockStep

    /**
     * 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].
     * @see Online Documentation
     */
    var shouldAnimate: Boolean

    /**
     * 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.
     * @return The new value of the [Clock.currentTime] property.
     * @see Online Documentation
     */
    fun tick(): JulianDate
}

inline fun Clock(
    block: Clock.() -> Unit,
): Clock =
    Clock().apply(block)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy