Class: SVGResource

PIXI.resources.SVGResource

Resource type for SVG elements and graphics.

new PIXI.resources.SVGResource (source, options)

Name Type Description
source string

Base64 encoded SVG element or URL for SVG file.

options object optional

Options to use

Name Type Default Description
scale number 1 optional

Scale to apply to SVG.

autoLoad boolean true optional

Start loading right away.

Extends

  • PIXI.resources.TextureResource

Members

PIXI.resources.SVGResource.SVG_SIZE RegExp | string staticconstant

RegExp for SVG size.

Example
<svg width="100" height="100"></svg>

scale number readonly

The source scale to apply to render

svg string readonly

Base64 encoded SVG element or URL for SVG file

Methods

PIXI.resources.SVGResource.getSize (svgString)PIXI.resources.SVGResource~Size static

Get size from an svg string using regexp.

Name Type Description
svgString string

a serialized svg element

Returns:
Type Description
PIXI.resources.SVGResource~Size image extension

PIXI.resources.SVGResource.test (source, extension) static

Used to auto-detect the type of resource.

Name Type Description
source *

The source object

extension string

The extension of source, if set

_loadDataUri (dataUri)

Reads an SVG string from data URI and then calls _loadString.

Name Type Description
dataUri string

The data uri to load from.

dispose ()

Destroys this texture

Type Definitions

Size object

Typedef for Size object.

Properties:
Name Type Description
width number

Width component

height number

Height component