PIXI.autoDetectResource

autoDetectResource(source: string | unknown, options: object) → {PIXI.Resource}

Create a resource element from a single source element. This auto-detects which type of resource to create. All resources that are auto-detectable must have a static test method and a constructor with the arguments (source, options?). Currently, the supported resources for auto-detection include:

Parameters:
Name Type Attributes Default Description
source string | unknown

Resource source, this can be the URL to the resource, a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri or any other resource that can be auto-detected. If not resource is detected, it's assumed to be an ImageResource.

options object

<optional>

Pass-through options to use for Resource

options.width number

<optional>

Width of BufferResource or SVG rasterization

options.height number

<optional>

Height of BufferResource or SVG rasterization

options.autoLoad boolean

<optional>

true

Image, SVG and Video flag to start loading

options.scale number

<optional>

1

SVG source scale. Overridden by width, height

options.createBitmap boolean

<optional>

PIXI.settings.CREATE_IMAGE_BITMAP

Image option to create Bitmap object

options.crossorigin boolean

<optional>

true

Image and Video option to set crossOrigin

options.autoPlay boolean

<optional>

true

Video option to start playing video immediately

options.updateFPS number

<optional>

0

Video option to update how many times a second the texture should be updated from the video. Leave at 0 to update at every render

Returns:
Type Description
PIXI.Resource

The created resource.

Powered by webdoc!