Namespace: PIXI

PIXI

Classes

AbstractBatchRenderer
AbstractRenderer
AnimatedSprite
Application
AppLoaderPlugin
Attribute
BasePrepare
BaseRenderTexture
BaseTexture
BatchDrawCall
BatchGeometry
BatchPluginFactory
BatchShaderGenerator
BatchTextureArray
BitmapFontLoader
BitmapText
Bounds
Buffer
CanvasExtract
CanvasGraphicsRenderer
CanvasMaskManager
CanvasMeshRenderer
CanvasPrepare
CanvasRenderer
CanvasRenderTarget
CanvasSpriteRenderer
Circle
Container
CountLimiter
CubeTexture
DisplayObject
Ellipse
Extract
FillStyle
Filter
FilterManager
Framebuffer
Geometry
GLProgram
GLTexture
Graphics
GraphicsData
GraphicsGeometry
LineStyle
Loader
LoaderResource
MaskData
Matrix
Mesh
MeshBatchUvs
MeshGeometry
MeshMaterial
NineSlicePlane
ObjectRenderer
ObservablePoint
ParticleContainer
ParticleRenderer
Point
Polygon
Prepare
Program
Quad
QuadUv
Rectangle
Renderer
RenderTexture
RenderTexturePool
RopeGeometry
RoundedRectangle
Runner
Shader
SimpleMesh
SimplePlane
SimpleRope
Sprite
SpriteMaskFilter
Spritesheet
SpritesheetLoader
Star
State
System
Text
TextMetrics
TextStyle
Texture
TextureLoader
TextureMatrix
TextureUvs
Ticker
TickerPlugin
TilingSprite
TilingSpriteRenderer
TimeLimiter
Transform
TransformBase
TransformStatic
UniformGroup
ViewableBuffer
WebGLRenderer

Namespaces

accessibility
CanvasTinter
canvasUtils
extract
extras
filters
graphicsUtils
groupD8
GroupD8
interaction
loaders
mesh
particles
prepare
resources
settings
systems
ticker
utils

Members

PIXI.ALPHA_MODES number static

How to treat textures with premultiplied alpha

Properties:
Name Type Description
NO_PREMULTIPLIED_ALPHA number

Source is not premultiplied, leave it like that. Option for compressed and data textures that are created from typed arrays.

PREMULTIPLY_ON_UPLOAD number

Source is not premultiplied, premultiply on upload. Default option, used for all loaded images.

PREMULTIPLIED_ALPHA number

Source is already premultiplied Example: spine atlases with _pma suffix.

NPM number

Alias for NO_PREMULTIPLIED_ALPHA.

UNPACK number

Default option, alias for PREMULTIPLY_ON_UPLOAD.

PMA number

Alias for PREMULTIPLIED_ALPHA.

PIXI.BLEND_MODES number static

Various blend modes supported by PIXI.

IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. Anything else will silently act like NORMAL.

Properties:
Name Type Description
NORMAL number
ADD number
MULTIPLY number
SCREEN number
OVERLAY number
DARKEN number
LIGHTEN number
COLOR_DODGE number
COLOR_BURN number
HARD_LIGHT number
SOFT_LIGHT number
DIFFERENCE number
EXCLUSION number
HUE number
SATURATION number
COLOR number
LUMINOSITY number
NORMAL_NPM number
ADD_NPM number
SCREEN_NPM number
NONE number
SRC_IN number
SRC_OUT number
SRC_ATOP number
DST_OVER number
DST_IN number
DST_OUT number
DST_ATOP number
SUBTRACT number
SRC_OVER number
ERASE number
XOR number

PIXI.DATA_URI RegExp | string staticconstant

Regexp for data URI. Based on: https://github.com/ragingwind/data-uri-regex

Example
data:image/png;base64

PIXI.defaultFilterVertex string static

Default filter vertex shader

PIXI.defaultVertex string static

Default vertex shader

PIXI.DEG_TO_RAD number staticconstant

Conversion factor for converting degrees to radians.

PIXI.DRAW_MODES number static

Various webgl draw modes. These can be used to specify which GL drawMode to use under certain situations and renderers.

Properties:
Name Type Description
POINTS number
LINES number
LINE_LOOP number
LINE_STRIP number
TRIANGLES number
TRIANGLE_STRIP number
TRIANGLE_FAN number

PIXI.ENV number static

Different types of environments for WebGL.

Properties:
Name Type Description
WEBGL_LEGACY number

Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility with older / less advanced devices. If you experience unexplained flickering prefer this environment.

WEBGL number

Version 1 of WebGL

WEBGL2 number

Version 2 of WebGL

PIXI.FORMATS number static

Various GL texture/resources formats.

Properties:
Name Type Default Description
RGBA number 6408
RGB number 6407
ALPHA number 6406
LUMINANCE number 6409
LUMINANCE_ALPHA number 6410
DEPTH_COMPONENT number 6402
DEPTH_STENCIL number 34041

PIXI.GC_MODES number static

The gc modes that are supported by pixi.

The PIXI.settings.GC_MODE Garbage Collection mode for PixiJS textures is AUTO If set to GC_MODE, the renderer will occasionally check textures usage. If they are not used for a specified period of time they will be removed from the GPU. They will of course be uploaded again when they are required. This is a silent behind the scenes process that should ensure that the GPU does not get filled up.

Handy for mobile devices! This property only affects WebGL.

Properties:
Name Type Description
AUTO number

Garbage collection will happen periodically automatically

MANUAL number

Garbage collection will need to be called manually

PIXI.GRAPHICS_CURVES object staticconstant

Graphics curves resolution settings. If adaptive flag is set to true, the resolution is calculated based on the curve's length to ensure better visual quality. Adaptive draw works with bezierCurveTo and quadraticCurveTo.

Properties:
Name Type Default Description
adaptive boolean false

flag indicating if the resolution should be adaptive

maxLength number 10

maximal length of a single segment of the curve (if adaptive = false, ignored)

minSegments number 8

minimal number of segments in the curve (if adaptive = false, ignored)

maxSegments number 2048

maximal number of segments in the curve (if adaptive = false, ignored)

PIXI.loader PIXI.Loader Deprecated : since 5.0.0 static

See:

PIXI.MASK_TYPES number static

Constants for mask implementations. We use type suffix because it leads to very different behaviours

Properties:
Name Type Description
NONE number

Mask is ignored

SCISSOR number

Scissor mask, rectangle on screen, cheap

STENCIL number

Stencil mask, 1-bit, medium, works only if renderer supports stencil

SPRITE number

Mask that uses SpriteMaskFilter, uses temporary RenderTexture

PIXI.MIPMAP_MODES number static

Mipmap filtering modes that are supported by pixi.

The PIXI.settings.MIPMAP_TEXTURES affects default texture filtering. Mipmaps are generated for a baseTexture if its mipmap field is ON, or its POW2 and texture dimensions are powers of 2. Due to platform restriction, ON option will work like POW2 for webgl-1.

This property only affects WebGL.

Properties:
Name Type Description
OFF number

No mipmaps

POW2 number

Generate mipmaps if texture dimensions are pow2

ON number

Always generate mipmaps

PIXI.PI_2 number staticconstant

Two Pi.

PIXI.PRECISION string static

Constants that specify float precision in shaders.

Properties:
Name Type Default Description
LOW string 'lowp'
MEDIUM string 'mediump'
HIGH string 'highp'

PIXI.RAD_TO_DEG number staticconstant

Conversion factor for converting radians to degrees.

PIXI.RENDERER_TYPE number static

Constant to identify the Renderer Type.

Properties:
Name Type Description
UNKNOWN number

Unknown render type.

WEBGL number

WebGL render type.

CANVAS number

Canvas render type.

PIXI.SCALE_MODES number static

The scale modes that are supported by pixi.

The PIXI.settings.SCALE_MODE scale mode affects the default scaling mode of future operations. It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.

Properties:
Name Type Description
LINEAR number

Smooth scaling

NEAREST number

Pixelating scaling

PIXI.SHAPES enum static

Constants that identify shapes, mainly to prevent instanceof calls.

Properties:
Name Type Description
POLY number

Polygon

RECT number

Rectangle

CIRC number

Circle

ELIP number

Ellipse

RREC number

Rounded Rectangle

PIXI.SVG_SIZE RegExp | string Deprecated : since 5.0.0 staticconstant

See:

PIXI.TARGETS number static

Various GL target types.

Properties:
Name Type Default Description
TEXTURE_2D number 3553
TEXTURE_CUBE_MAP number 34067
TEXTURE_2D_ARRAY number 35866
TEXTURE_CUBE_MAP_POSITIVE_X number 34069
TEXTURE_CUBE_MAP_NEGATIVE_X number 34070
TEXTURE_CUBE_MAP_POSITIVE_Y number 34071
TEXTURE_CUBE_MAP_NEGATIVE_Y number 34072
TEXTURE_CUBE_MAP_POSITIVE_Z number 34073
TEXTURE_CUBE_MAP_NEGATIVE_Z number 34074

PIXI.TEXT_GRADIENT object staticconstant

Constants that define the type of gradient on text.

Properties:
Name Type Description
LINEAR_VERTICAL number

Vertical gradient

LINEAR_HORIZONTAL number

Linear gradient

PIXI.TRANSFORM_MODE number Deprecated : since 5.0.0 static

Constants that specify the transform type.

Properties:
Name Type Description
STATIC number
DYNAMIC number

PIXI.TYPES number static

Various GL data format types.

Properties:
Name Type Default Description
UNSIGNED_BYTE number 5121
UNSIGNED_SHORT number 5123
UNSIGNED_SHORT_5_6_5 number 33635
UNSIGNED_SHORT_4_4_4_4 number 32819
UNSIGNED_SHORT_5_5_5_1 number 32820
FLOAT number 5126
HALF_FLOAT number 36193

PIXI.UPDATE_PRIORITY number static

Represents the update priorities used by internal PIXI classes when registered with the PIXI.Ticker object. Higher priority items are updated first and lower priority items, such as render, should go later.

Properties:
Name Type Default Description
INTERACTION number 50

Highest priority, used for PIXI.interaction.InteractionManager

HIGH number 25

High priority updating, PIXI.VideoBaseTexture and PIXI.AnimatedSprite

NORMAL number 0

Default priority for ticker events, see PIXI.Ticker#add.

LOW number -25

Low priority used for PIXI.Application rendering.

UTILITY number -50

Lowest priority used for PIXI.prepare.BasePrepare utility.

PIXI.VERSION string staticconstant

String of the current PIXI version.

PIXI.WRAP_MODES number static

The wrap modes that are supported by pixi.

The PIXI.settings.WRAP_MODE wrap mode affects the default wrapping mode of future operations. It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. If the texture is non power of two then clamp will be used regardless as WebGL can only use REPEAT if the texture is po2.

This property only affects WebGL.

Properties:
Name Type Description
CLAMP number

The textures uvs are clamped

REPEAT number

The texture uvs tile and repeat

MIRRORED_REPEAT number

The texture uvs tile and repeat with mirroring

Methods

PIXI.autoDetectRenderer (options)PIXI.Renderer | PIXI.CanvasRenderer static

This helper function will automatically detect which renderer you should be using. WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by the browser then this function will return a canvas renderer

Name Type Description
options object optional

The optional renderer parameters

Name Type Default Description
width number 800 optional

the width of the renderers view

height number 600 optional

the height of the renderers view

view HTMLCanvasElement optional

the canvas to use as a view, optional

transparent boolean false optional

If the render view is transparent, default false

autoDensity boolean false optional

Resizes renderer view in CSS pixels to allow for resolutions other than 1

antialias boolean false optional

sets antialias

preserveDrawingBuffer boolean false optional

enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context

backgroundColor number 0x000000 optional

The background color of the rendered area (shown if not transparent).

clearBeforeRender boolean true optional

This sets if the renderer will clear the canvas or not before the new render pass.

resolution number 1 optional

The resolution / device pixel ratio of the renderer, retina would be 2

forceCanvas boolean false optional

prevents selection of WebGL renderer, even if such is present, this option only is available when using pixi.js-legacy or @pixi/canvas-renderer modules, otherwise it is ignored.

forceFXAA boolean false optional

forces FXAA antialiasing to be used over native. FXAA is faster, but may not always look as great webgl only

powerPreference string optional

Parameter passed to webgl context, set to "high-performance" for devices with dual graphics card webgl only

Returns:
Type Description
PIXI.Renderer | PIXI.CanvasRenderer Returns WebGL renderer if available, otherwise CanvasRenderer

PIXI.useDeprecated () static

Deprecations (backward compatibilities) are automatically applied for browser bundles in the UMD module format. If using Webpack or Rollup, you'll need to apply these deprecations manually by doing something like this:

Example
import * as PIXI from 'pixi.js';
PIXI.useDeprecated(); // MUST be bound to namespace

Type Definitions

PIXI.GD8Symmetry number

See:

PIXI.ICanvasImageSource HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap

Types that can be passed to drawImage

PIXI.IFontMetrics

A number, or a string containing a number.

Properties:
Name Type Description
ascent number

Font ascent

descent number

Font descent

fontSize number

Font size

PIXI.ILoaderPlugin

Plugin to be installed for handling specific Loader resources.

Properties:
Name Type Argument Description
add function <optional>

Function to call immediate after registering plugin.

pre PIXI.Loader.loaderMiddleware <optional>

Middleware function to run before load, the arguments for this are (resource, next)

use PIXI.Loader.loaderMiddleware <optional>

Middleware function to run after load, the arguments for this are (resource, next)

PIXI.ISize object

Size object, contains width and height

Properties:
Name Type Description
width number

Width component

height number

Height component

Interface Definitions

PIXI.IHitArea

Interface for classes that represent a hit area.

It is implemented by the following classes:

PIXI.IPoint

Common interface for points. Both Point and ObservablePoint implement it