Path2

Hierarchy

  • Path2

Index

Constructors

constructor

  • new Path2(x: number, y: number): Path2
  • Creates a Path2 object from the starting 2D coordinates x and y.

    Parameters

    • x: number
    • y: number

    Returns Path2

Properties

closed

closed: boolean

Methods

addArcTo

  • addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2
  • Adds numberOfSegments segments according to the arc definition (middle point coordinates, end point coordinates, the arc start point being the current Path2 last point) to the current Path2. Returns the updated Path2.

    Parameters

    • midX: number
    • midY: number
    • endX: number
    • endY: number
    • Optional numberOfSegments: number

    Returns Path2

addLineTo

  • addLineTo(x: number, y: number): Path2
  • Adds a new segment until the given coordinates (x, y) to the current Path2. Returns the updated Path2.

    Parameters

    • x: number
    • y: number

    Returns Path2

close

  • Closes the Path2. Returns the Path2.

    Returns Path2

getPointAtLengthPosition

  • getPointAtLengthPosition(normalizedLengthPosition: number): Vector2
  • Returns a new Vector2 located at a percentage of the Path2 total length on this path.

    Parameters

    • normalizedLengthPosition: number

    Returns Vector2

getPoints

  • Returns the Path2 internal array of points.

    Returns Vector2[]

length

  • length(): number
  • Returns the Path2 total length (float).

    Returns number

Static StartingAt

  • StartingAt(x: number, y: number): Path2
  • Returns a new Path2 starting at the coordinates (x, y).

    Parameters

    • x: number
    • y: number

    Returns Path2

Generated using TypeDoc