Class BaseCamera

Implements

Constructors

  • Parameters

    • viewPortWidth: number = 1000

      The width of the viewport. (The width of the canvas in css pixels)

    • viewPortHeight: number = 1000

      The height of the viewport. (The height of the canvas in css pixels)

    • position: Point = ...

      The position of the camera in the world coordinate system

    • rotation: number = 0

      The rotation of the camera in the world coordinate system

    • zoomLevel: number = 1

      The zoom level of the camera

    • boundaries: Boundaries = ...

      The boundaries of the camera in the world coordinate system

    • zoomLevelBoundaries: ZoomLevelLimits = ...

      The boundaries of the zoom level of the camera

    • rotationBoundaries: RotationLimits = undefined

      The boundaries of the rotation of the camera

    Returns BaseCamera

Accessors

Methods

  • Parameters

    • devicePixelRatio: number

      The device pixel ratio of the canvas

    • alignCoorindate: boolean

      Whether to align the coordinate system to the camera's position

    Returns { a: number; b: number; c: number; d: number; e: number; f: number }

    The transformation matrix

    The order of the transformation is as follows:

    1. Scale (scale the context using the device pixel ratio)
    2. Translation (move the origin of the context to the center of the canvas)
    3. Rotation (rotate the context negatively the rotation of the camera)
    4. Zoom (scale the context using the zoom level of the camera)
    5. Translation (move the origin of the context to the position of the camera in the context coordinate system)