# Class DeltaTimeCalculator

A helper class for calculating the elapsed time between frames.

Handles the case where the browser tab is not in focus and `requestAnimationFrame` does not get called for performance reasons. In this case, the returned deltaTime won't be an unreasonably large value.

- Defined in helper/delta-time-calculator.ts:8

##### Index

### Constructors

constructor

### Methods

destroy
getNextDeltaTime

## Constructors

### constructor

- new DeltaTimeCalculator(): DeltaTimeCalculator

  #### Returns DeltaTimeCalculator

  - Defined in helper/delta-time-calculator.ts:12

## Methods

### destroy

- destroy(): void

  #### Returns void

  - Defined in helper/delta-time-calculator.ts:35

### getNextDeltaTime

- getNextDeltaTime(currentTime: number): number

  Return the elapsed time in milliseconds since the previous call of this method by subtracting the previously given `currentTime` argument from the current `currentTime` argument.

  Takes visibilitychange events into account.

  #### Parameters

  - currentTime: number

    Current time acquired e.g. with `requestAnimationFrame`.

  #### Returns number

  - Defined in helper/delta-time-calculator.ts:25