Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Time

Store time values and make them easy to access from anywhere in your game just by importing this static class.

Hierarchy

  • Time

Index

Accessors

Methods

Accessors

Static FPS

  • get FPS(): number
  • The average amount of frames per second based on the current deltaTime.

    Returns number

Static deltaTime

  • get deltaTime(): number
  • The time elapsed since the last frame, in milliseconds.

    Returns number

Static second

  • get second(): number
  • The deltaTime in second. Useful for animations.
    Let's say we want our gameObject.x property to move +10 pixels per second, we can do that: gameObject.x += 10 * Time.second;

    Returns number

Static time

  • get time(): number
  • The time elapsed since the game has started being rendered, in milliseconds.

    Returns number

Methods

Static _setFrame

  • _setFrame(frame: number): void
  • Used internally to update the time data.

    Parameters

    • frame: number

      The total time elapsed in milliseconds, passed in by the browser.

    Returns void

Generated using TypeDoc