Navigation
These archived docs are for Phaser 2.6.1 Phaser 3 docs can be found on newdocs.phaser.io.
Phaser CE docs can be found on the Phaser CE Documentation site.

Constructor

PIXI.PIXI. DisplayObject

new DisplayObject()

The base class for all objects that are rendered. Contains properties for position, scaling, rotation, masks and cache handling.

This is an abstract class and should not be used on its own, rather it should be extended.

It is used internally by the likes of PIXI.Sprite.

Source code: pixi/display/DisplayObject.js (Line 7)

Public Properties

alpha : number

The alpha value of this DisplayObject. A value of 1 is fully opaque. A value of 0 is transparent. Please note that an object with an alpha value of 0 is skipped during the render pass.

The value of this property does not reflect any alpha values set further up the display list. To obtain that value please see the worldAlpha property.

Source code: pixi/display/DisplayObject.js (Line 63)

cacheAsBitmap : boolean

Sets if this DisplayObject should be cached as a bitmap.

When invoked it will take a snapshot of the DisplayObject, as it is at that moment, and store it in a RenderTexture. This is then used whenever this DisplayObject is rendered. It can provide a performance benefit for complex, but static, DisplayObjects. I.e. those with lots of children.

Cached Bitmaps do not track their parents. If you update a property of this DisplayObject, it will not re-generate the cached bitmap automatically. To do that you need to call DisplayObject.updateCache.

To remove a cached bitmap, set this property to null.

Source code: pixi/display/DisplayObject.js (Line 779)

filterArea :Rectangle

The rectangular area used by filters when rendering a shader for this DisplayObject.

Source code: pixi/display/DisplayObject.js (Line 204)

filters : Array

Sets the filters for this DisplayObject. This is a WebGL only feature, and is ignored by the Canvas Renderer. A filter is a shader applied to this DisplayObject. You can modify the placement of the filter using DisplayObject.filterArea.

To remove filters, set this property to null.

Note: You cannot have a filter set, and a MULTIPLY Blend Mode active, at the same time. Setting a filter will reset this DisplayObjects blend mode to NORMAL.

Source code: pixi/display/DisplayObject.js (Line 726)

hitArea :Rectangle | Circle | Ellipse | Polygon

This is the defined area that will pick up mouse / touch events. It is null by default. Setting it is a neat way of optimising the hitTest function that the interactionManager will use (as it will not need to hit test all the children)

Type
  • Rectangle | Circle | Ellipse | Polygon
Source code: pixi/display/DisplayObject.js (Line 89)

mask :PIXIGraphics

Sets a mask for this DisplayObject. A mask is an instance of a Graphics object. When applied it limits the visible area of this DisplayObject to the shape of the mask. Under a Canvas renderer it uses shape clipping. Under a WebGL renderer it uses a Stencil Buffer. To remove a mask, set this property to null.

Source code: pixi/display/DisplayObject.js (Line 691)

[readonly] parent :PIXIDisplayObjectContainer

The parent DisplayObjectContainer that this DisplayObject is a child of. All DisplayObjects must belong to a parent in order to be rendered. The root parent is the Stage object. This property is set automatically when the DisplayObject is added to, or removed from, a DisplayObjectContainer.

Source code: pixi/display/DisplayObject.js (Line 107)

pivot :PIXIPoint

The pivot point of this DisplayObject that it rotates around. The values are expressed in pixel values.

Source code: pixi/display/DisplayObject.js (Line 43)

position :PIXIPoint

The coordinates, in pixels, of this DisplayObject, relative to its parent container.

The value of this property does not reflect any positioning happening further up the display list. To obtain that value please see the worldPosition property.

Source code: pixi/display/DisplayObject.js (Line 20)

renderable : boolean

Should this DisplayObject be rendered by the renderer? An object with a renderable value of false is skipped during the render pass.

Source code: pixi/display/DisplayObject.js (Line 98)

rotation : number

The rotation of this DisplayObject. The value is given, and expressed, in radians, and is based on a right-handed orientation.

The value of this property does not reflect any rotation happening further up the display list. To obtain that value please see the worldRotation property.

Source code: pixi/display/DisplayObject.js (Line 51)

scale :PIXIPoint

The scale of this DisplayObject. A scale of 1:1 represents the DisplayObject at its default size. A value of 0.5 would scale this DisplayObject by half, and so on.

The value of this property does not reflect any scaling happening further up the display list. To obtain that value please see the worldScale property.

Source code: pixi/display/DisplayObject.js (Line 31)

[readonly] stage :PIXIStage

The stage that this DisplayObject is connected to.

Source code: pixi/display/DisplayObject.js (Line 119)

visible : boolean

The visibility of this DisplayObject. A value of false makes the object invisible. A value of true makes it visible. Please note that an object with a visible value of false is skipped during the render pass. Equally a DisplayObject with visible false will not render any of its children.

The value of this property does not reflect any visible values set further up the display list. To obtain that value please see the worldVisible property.

Source code: pixi/display/DisplayObject.js (Line 75)

[readonly] worldAlpha : number

The multiplied alpha value of this DisplayObject. A value of 1 is fully opaque. A value of 0 is transparent. This value is the calculated total, based on the alpha values of all parents of this DisplayObjects in the display list.

To obtain, and set, the local alpha value, see the alpha property.

Note: This property is only updated at the end of the updateTransform call, once per render. Until that happens this property will contain values based on the previous frame. Be mindful of this if accessing this property outside of the normal game flow, i.e. from an asynchronous event callback.

Source code: pixi/display/DisplayObject.js (Line 128)

[readonly] worldPosition :PIXIPoint

The coordinates, in pixels, of this DisplayObject within the world.

This property contains the calculated total, based on the positions of all parents of this DisplayObject in the display list.

Note: This property is only updated at the end of the updateTransform call, once per render. Until that happens this property will contain values based on the previous frame. Be mindful of this if accessing this property outside of the normal game flow, i.e. from an asynchronous event callback.

Source code: pixi/display/DisplayObject.js (Line 159)

[readonly] worldRotation : number

The rotation, in radians, of this DisplayObject.

This property contains the calculated total, based on the rotations of all parents of this DisplayObject in the display list.

Note: This property is only updated at the end of the updateTransform call, once per render. Until that happens this property will contain values based on the previous frame. Be mindful of this if accessing this property outside of the normal game flow, i.e. from an asynchronous event callback.

Source code: pixi/display/DisplayObject.js (Line 189)

[readonly] worldScale :PIXIPoint

The global scale of this DisplayObject.

This property contains the calculated total, based on the scales of all parents of this DisplayObject in the display list.

Note: This property is only updated at the end of the updateTransform call, once per render. Until that happens this property will contain values based on the previous frame. Be mindful of this if accessing this property outside of the normal game flow, i.e. from an asynchronous event callback.

Source code: pixi/display/DisplayObject.js (Line 174)

[readonly] worldTransform :PIXIMatrix

The current transform of this DisplayObject.

This property contains the calculated total, based on the transforms of all parents of this DisplayObject in the display list.

Note: This property is only updated at the end of the updateTransform call, once per render. Until that happens this property will contain values based on the previous frame. Be mindful of this if accessing this property outside of the normal game flow, i.e. from an asynchronous event callback.

Source code: pixi/display/DisplayObject.js (Line 144)

worldVisible : boolean

Indicates if this DisplayObject is visible, based on it, and all of its parents, visible property values.

Source code: pixi/display/DisplayObject.js (Line 656)

x : number

The horizontal position of the DisplayObject, in pixels, relative to its parent. If you need the world position of the DisplayObject, use DisplayObject.worldPosition instead.

Source code: pixi/display/DisplayObject.js (Line 612)

y : number

The vertical position of the DisplayObject, in pixels, relative to its parent. If you need the world position of the DisplayObject, use DisplayObject.worldPosition instead.

Source code: pixi/display/DisplayObject.js (Line 634)