Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

LineCapStyle: "butt" | "round" | "square"

A canvas linecap style. "butt" is the default flush style, "round" is a semi-circle cap with a radius half the width of the line, and "square" is a rectangle that is an equal width and half height cap.

Functions

  • circle(ctx: CanvasRenderingContext2D, x: number, y: number, radius: number, stroke?: Color, fill?: Color): void
  • Parameters

    • ctx: CanvasRenderingContext2D
    • x: number
    • y: number
    • radius: number
    • stroke: Color = Color.White
    • fill: Color = null

    Returns void

  • line(ctx: CanvasRenderingContext2D, color?: Color, x1: number, y1: number, x2: number, y2: number, thickness?: number, cap?: LineCapStyle): void
  • Draw a line on canvas context

    Parameters

    • ctx: CanvasRenderingContext2D

      The canvas context

    • color: Color = Color.Red

      The color of the line

    • x1: number

      The start x coordinate

    • y1: number

      The start y coordinate

    • x2: number

      The ending x coordinate

    • y2: number

      The ending y coordinate

    • thickness: number = 1

      The line thickness

    • cap: LineCapStyle = 'butt'

      The LineCapStyle (butt, round, or square)

    Returns void

  • point(ctx: CanvasRenderingContext2D, color?: Color, point: Vector): void
  • Draw the vector as a point onto the canvas.

    Parameters

    • ctx: CanvasRenderingContext2D
    • color: Color = Color.Red
    • point: Vector

    Returns void

  • roundRect(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius?: number | BorderRadius, stroke?: Color, fill?: Color): void
  • Draw a round rectangle on a canvas context

    Parameters

    • ctx: CanvasRenderingContext2D

      The canvas context

    • x: number

      The top-left x coordinate

    • y: number

      The top-left y coordinate

    • width: number

      The width of the rectangle

    • height: number

      The height of the rectangle

    • radius: number | BorderRadius = 5

      The border radius of the rectangle

    • stroke: Color = Color.White

      The Color to stroke rectangle with

    • fill: Color = null

      The Color to fill rectangle with

    Returns void

  • vector(ctx: CanvasRenderingContext2D, color: Color, origin: Vector, vector: Vector, scale?: number): void