Class

RezAsset

RezAsset()

Constructor

# new RezAsset()

Represents a media asset in the Rez game engine. Assets can be images, audio, video, or text files. Provides methods for determining asset type and generating HTML elements for display. Asset MIME types are detected during compilation and stored in the $detected_mime_type attribute.

View Source rez_asset.js, line 5

Extends

Methods

# static assetType() → {string}

Returns the primary MIME type category for this asset

View Source rez_asset.js, line 25

if no MIME type information is available

Error

the primary asset type (e.g., "image", "audio", "video", "text")

string

# static audioTag()

Placeholder for generating HTML audio tags (not yet implemented)

View Source rez_asset.js, line 80

audio tags are not yet implemented

Error

# static constructor(id, attributes)

Creates a new asset instance

Parameters:
Name Type Description
id string

unique identifier for this asset

attributes object

asset attributes from Rez compilation including file path and MIME type

View Source rez_asset.js, line 14

# static getHeight(h) → {number}

Gets the height for this asset, using the provided override if available, falling back to the asset's height attribute.

Parameters:
Name Type Description
h number

optional height override

View Source rez_asset.js, line 112

if no height is specified and no default is provided

Error

the height to use for this asset

number

# static getWidth(w) → {number}

Gets the width for this asset, using the provided override if available, falling back to the asset's width attribute.

Parameters:
Name Type Description
w number

optional width override

View Source rez_asset.js, line 90

if no width is specified and no default is provided

Error

the width to use for this asset

number

# static imageElement(w, h) → {HTMLImageElement}

Creates an HTML image element for this asset with the specified or default dimensions

Parameters:
Name Type Description
w number

optional width override

h number

optional height override

View Source rez_asset.js, line 134

an HTML image element configured for this asset

HTMLImageElement

# static imageTag(w, h) → {string}

Generates an HTML image tag string for this asset with specified or default dimensions

Parameters:
Name Type Description
w number

optional width override

h number

optional height override

View Source rez_asset.js, line 150

HTML image tag as a string

string

# static isAudio() → {boolean}

Determines if this asset is an audio file

View Source rez_asset.js, line 50

true if this asset is an audio file

boolean

# static isImage() → {boolean}

Determines if this asset is an image file

View Source rez_asset.js, line 40

true if this asset is an image

boolean

# static isText() → {boolean}

Determines if this asset is a text file

View Source rez_asset.js, line 70

true if this asset is a text file

boolean

# static isVideo() → {boolean}

Determines if this asset is a video file

View Source rez_asset.js, line 60

true if this asset is a video file

boolean

# static videoTag()

Placeholder for generating HTML video tags (not yet implemented)

View Source rez_asset.js, line 162

video tags are not yet implemented

Error