Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Ending

Contains the base frame of the ending animation but also provides methods to access the animation information. To simply play the animation it is recommended to use the EndingPlayer class.

Hierarchy

Implements

Index

Constructors

Protected constructor

  • new Ending(data: Uint8Array, width: number, height: number): Ending
  • Creates a new tile image with the given image data.

    Parameters

    • data: Uint8Array

      The image data (Each byte contains two 4-bit colors).

    • width: number

      The image width in pixels.

    • height: number

      The image height in pixels.

    Returns Ending

Properties

Protected data

data: Uint8Array

The image data.

Protected height

height: number

The image height in pixels.

Protected width

width: number

The image width in pixels.

Methods

createPlayer

draw

  • draw(ctx: CanvasRenderingContext2D, x?: number, y?: number): void
  • Draws the image onto the given rendering context.

    Parameters

    • ctx: CanvasRenderingContext2D

      The rendering context to draw the image to.

    • Default value x: number = 0

      Optional horizontal target position. Defaults to 0.

    • Default value y: number = 0

      Optional vertical target position. Defaults to 0.

    Returns void

getColor

  • getColor(x: number, y: number): number

getData

  • getData(): Uint8Array

getHeight

  • getHeight(): number

getNumUpdates

  • getNumUpdates(): number
  • Returns the number of animation updates.

    Returns number

    The number of animation updates.

getUpdate

  • Returns the animation update with the given index.

    Parameters

    • index: number

      Animation update index.

    Returns EndingUpdate

    The animation update.

getUpdates

getWidth

  • getWidth(): number

toCanvas

  • toCanvas(): HTMLCanvasElement

toDataUrl

  • toDataUrl(type?: undefined | string, ...args: any[]): string
  • Creates and returns an image data URL.

    Parameters

    • Optional type: undefined | string

      Optional image mime type. Defaults to image/png.

    • Rest ...args: any[]

      Optional additional encoder parameters. For image/jpeg this is the image quality between 0 and 1 with a default value of 0.92.

    Returns string

    The created data URL.

toImage

  • toImage(type?: undefined | string, ...args: any[]): HTMLImageElement
  • Creates and returns a HTML image.

    Parameters

    • Optional type: undefined | string

      Optional image mime type. Defaults to image/png.

    • Rest ...args: any[]

      Optional additional encoder parameters. For image/jpeg this is the image quality between 0 and 1 with a default value of 0.92.

    Returns HTMLImageElement

    The created HTML image.

Static fromArray

  • fromArray(array: Uint8Array): Ending
  • Parses a end animation from the given array and returns it.

    Parameters

    • array: Uint8Array

    Returns Ending

    The parsed end animation.

Static fromBlob

  • fromBlob(blob: Blob): Promise<Ending>
  • Reads the end animation from the given blob and returns it.

    Parameters

    • blob: Blob

      The END.CPA blob.

    Returns Promise<Ending>

    The read end animation.

Generated using TypeDoc