Class: Time

Time()

Time class that manages time-related operations and triggers events on each tick. Extends EventEmitter to handle event-driven architecture.

Constructor

new Time()

Creates an instance of Time. Initializes the current time and start time to the current timestamp. Starts the animation frame loop and the periodic interval for time updates.
Source:

Methods

getCurrentTime() → {number}

Get the current timestamp in milliseconds.
Source:
Returns:
The current timestamp.
Type
number

getDeltaTime() → {number}

Get the time difference between the current frame and the previous frame in milliseconds.
Source:
Returns:
The delta time.
Type
number

getElapsedTime() → {number}

Get the total elapsed time since the Time instance was created.
Source:
Returns:
The elapsed time.
Type
number

getStartTime() → {number}

Get the start timestamp when the Time instance was created.
Source:
Returns:
The start timestamp.
Type
number

pause()

Pause the time-related operations. Call this method when pausing the simulation or stopping time updates.
Source:

reset()

Reset the time-related variables and intervals. Call this method to reset time and stop ongoing calculations.
Source:

resume()

Resume the time-related operations. Call this method to resume time updates after pausing.
Source:

start()

Start the time-related operations. Call this method to begin time updates for the simulation.
Source: