Class InfluencedCamera

A camera being influenced by target influences (like velocity) and cues (points of interest). Optionally it can be contained within specified bounds.

Hierarchy (view full)

Constructors

Properties

bounds: null | CameraBounds = null
cueConfigs: CueConfig[] = []
finalOffset: Vector2 = ...
finalZoom: number = 1
modelView: Matrix4 = ...

The model view matrix of this camera. Do not modify outside of camera code.

offset: Vector2 = ...
projection: Matrix4 = ...

The projection matrix of this camera. Do not modify outside of camera code.

savedZoom: number
snapToPixel: boolean = true

If set to true, the position will be snapped to pixels.

target: null | InfluencedCameraTarget = null
viewportHeight: number = 0
viewportWidth: number = 0
x: number = 0
y: number = 0
zoom: number = 1

Methods

  • Returns number

    The current x position of the camera (before snapping to pixels).

  • Returns number

    The current y position of the camera (before snapping to pixels).

  • Unregister all cues for this camera.

    Parameters

    • fadeTime: number = 0

      0 to fade out the cues instead of instantly removing them.

    Returns void

  • Unregister a cue for this camera.

    Parameters

    • cue: InfluencedCameraCue

      The cue to remove.

    • fadeTime: number = 0

      0 to fade out this cue instead of instantly removing it.

    Returns void

  • Set the new viewport size of the camera.

    Parameters

    • width: number

      The new width of the viewport.

    • height: number

      The new height of the viewport.

    Returns void

  • Set the camera to the specified coordinates and apply pixel snapping if configured.

    Parameters

    • x: number

      The new x position of the camera.

    • y: number

      The new y position of the camera.

    Returns void

  • Set the zoom value and update the projection matrix accordingly.

    Parameters

    • zoom: number

      The new zoom value.

    Returns void

  • Perform camera movement.

    Parameters

    • deltaTime: number

      The time that elapsed since the last frame.

    Returns void

  • Update all fading cues.

    Parameters

    • deltaTime: number

      The time that elapsed since the last frame.

    Returns void

  • Update all influences and calculate the final offset and zoom.

    Returns void

  • Lerp the zoom level towards a new value.

    Parameters

    • zoom: number

      The target zoom level.

    Returns void