Namespace: utils

PIXI. utils

Methods

staticPIXI.utils.canUseNewCanvasBlendModes(){boolean}

Deprecated
  • Yes
See:
Returns:
Type Description
boolean Can use blend modes.

staticPIXI.utils.exports.decomposeDataUri(dataUri){DecomposedDataUri|undefined}

Split a data URI into components. Returns undefined if
parameter dataUri is not a valid data URI.

Name Type Description
dataUri string

the data URI to check

Returns:
Type Description
DecomposedDataUri | undefined The decomposed data uri or undefined

staticPIXI.utils.exports.getResolutionOfUrl(url){number}

get the resolution / device pixel ratio of an asset by looking for the prefix
used by spritesheets and image urls

Name Type Description
url string

the image path

Returns:
Type Description
number resolution / device pixel ratio of an asset

staticPIXI.utils.exports.getSvgSize(svgString){Size|undefined}

Get size from an svg string using regexp.

Name Type Description
svgString string

a serialized svg element

Returns:
Type Description
Size | undefined image extension

staticPIXI.utils.exports.getUrlFileExtension(url){string|undefined}

Get type of the image by regexp for extension. Returns undefined for unknown extensions.

Name Type Description
url string

the image path

Returns:
Type Description
string | undefined image extension

staticPIXI.utils.exports.hex2rgb(hex, out){Array.<number>}

Converts a hex color number to an [R, G, B] array

Name Type Default Description
hex number

The number to convert

out Array.<number> [] optional

If supplied, this array will be used rather than returning a new one

Returns:
Type Description
Array.<number> An array representing the [R, G, B] of the color.

staticPIXI.utils.exports.hex2string(hex){string}

Converts a hex color number to a string.

Name Type Description
hex number

Number in hex

Returns:
Type Description
string The string color.

staticPIXI.utils.exports.isWebGLSupported(){boolean}

Helper for checking for webgl support

Returns:
Type Description
boolean is webgl supported

staticPIXI.utils.exports.removeItems(arr, startIdx, removeCount)

Remove a range of items from an array

Name Type Description
arr Array.<*>

The target array

startIdx number

The index to begin removing from (inclusive)

removeCount number

How many items to remove

staticPIXI.utils.exports.rgb2hex(rgb){number}

Converts a color as an [R, G, B] array to a hex number

Name Type Description
rgb Array.<number>

rgb array

Returns:
Type Description
number The color number

staticPIXI.utils.exports.sign(n){number}

Returns sign of number

Name Type Description
n number

the number to check the sign of

Returns:
Type Description
number 0 if n is 0, -1 if n is negative, 1 if n is positive

staticPIXI.utils.exports.uid(){number}

Gets the next unique identifier

Returns:
Type Description
number The next unique identifier to use.

staticPIXI.utils.uuid(){number}

Deprecated
  • since version 3.0.6
    See:
    • PIXI.utils.uid
    Returns:
    Type Description
    number The uid