dino-ge
    Preparing search index...

    Class Camera

    Manages the viewport and transformation of the game world.

    Index
    position: Vector2 = ...

    Current camera position in world space.

    zoom: number = 1

    Zoom level of the camera.

    • Centres the camera on a target object. With world bounds, follows the target's rendered centre and keeps the viewport within the rectangle where it fits. If the viewport is larger than the world on an axis, centres that axis.

      Parameters

      • target: GameObject

        The object to follow.

      • viewportWidth: number

        Width of the viewport in pixels.

      • viewportHeight: number

        Height of the viewport in pixels.

      • Optionalbounds: CameraBounds

        Optional world rectangle with finite coordinates and non-negative dimensions.

      Returns void

    • Eases towards the target's rendered world centre using elapsed game time. With bounds, constrains the current origin and the destination before easing. An oversized axis centres immediately, including when elapsed time is zero.

      Parameters

      Returns void

    • Returns the current viewport bounds in world space.

      Parameters

      • width: number

        Width of the viewport in pixels.

      • height: number

        Height of the viewport in pixels.

      Returns { height: number; width: number; x: number; y: number }

      An object representing the x, y, width, and height of the visible area.