Skip to main content

Gif

The Texture object allows games built in Excalibur to load image resources. Texture is an Loadable which means it can be passed to a Loader to pre-load before starting a level or game.

Implements

Index

Constructors

constructor

  • new Gif(path: string, bustCache?: boolean): Gif
  • Parameters

    • path: string

      Path to the image resource

    • bustCache: boolean = false

      Optionally load texture with cache busting

    Returns Gif

Properties

publicdata

data: ImageSource[] = []

Data associated with a loadable

publicheight

height: number = 0

The height of the texture in pixels

publicpath

path: string

Path to the image resource

publicwidth

width: number = 0

The width of the texture in pixels

Accessors

publicbustCache

  • get bustCache(): boolean
  • set bustCache(val: boolean): void
  • Should excalibur add a cache busting querystring? By default false. Must be set before loading


    Returns boolean

  • Parameters

    • val: boolean

    Returns void

publicreadCheckBytes

  • get readCheckBytes(): number[]
  • Returns number[]

Methods

publicisLoaded

  • isLoaded(): boolean
  • Returns true if the loadable is loaded


    Returns boolean

publicload

  • Begins loading the texture and returns a promise to be resolved on completion


    Returns Promise<ImageSource[]>

publictoAnimation

  • toAnimation(durationPerFrameMs?: number): Animation
  • Transform the GIF into an animation with duration per frame


    Parameters

    • optionaldurationPerFrameMs: number

      Optionally override duration per frame

    Returns Animation

publictoSprite

  • Return a frame of the gif as a sprite by id


    Parameters

    • id: number = 0

    Returns Sprite

publictoSpriteSheet