Manages the asset loading (images, fonts, audios, videos).

this.assetManager.loadImage("image.png");
this.assetManager.loadAudio("audio.ogg");
this.assetManager.loadVideo("video.mp4");
this.assetManager.loadFont("custom-font", "custom-font.ttf");

const imageElement = this.assetManager.getImage("image.png");
const audioElement = this.assetManager.getAudio("audio.ogg");
const videoElement = this.assetManager.getVideo("video.mp4");
const fontFace = this.assetManager.getFont("custom-font");

if (this.assetManager.getAssetsLoaded()) {
// do something when assets are loaded
}

Constructors

Methods

  • Returns TRUE if the assets are loaded

    Returns boolean

    TRUE or FALSE

  • Retrieves an audio asset

    Parameters

    • url: string

      The asset URL

    Returns HTMLAudioElement

    The HTML Audio element

  • Retrieves a font asset

    Parameters

    • family: string

      The font family name

    Returns FontFace

    The Font element

  • Retrieves an image asset

    Parameters

    • url: string

      The asset URL

    Returns HTMLImageElement

    The HTML Image element

  • Retrieves a video asset

    Parameters

    • url: string

      The asset URL

    Returns HTMLVideoElement

    The HTML Video element

  • Loads an audio asset

    Parameters

    • url: string

      The asset URL

    Returns HTMLAudioElement

    The HTML Audio element created

  • Loads a font asset

    Parameters

    • family: string

      The font family name

    • url: string

      The asset URL

    Returns FontFace

    The FontFace object created

  • Loads an image asset

    Parameters

    • url: string

      The asset URL

    Returns HTMLImageElement

    The HTML Image element created

  • Loads an video asset

    Parameters

    • url: string

      The asset URL

    Returns HTMLVideoElement

    The HTML Video element created