PIXI.DisplayObject#
Needs docs.
PIXI.DisplayObject#
Needs docs.
The bounds object, this is used to calculate and store the bounds of the displayObject.
PIXI.DisplayObject#_bounds
Protected
_boundsIDFlags the cached bounds as dirty.
PIXI.DisplayObject#_boundsID
Protected
_boundsCache of this display-object's bounds-rectangle.
PIXI.DisplayObject#_boundsRect
Protected
_cachedCached tint value so we can tell when the tint is changed. Value is used for 2d CanvasRenderer.
PIXI.Sprite#_cachedTint
0xFFFFFF
Protected
_destroyedIf the object has been destroyed via destroy(). If true, it should not be used.
PIXI.DisplayObject#_destroyed
Protected
_enabledCurrently enabled filters
PIXI.DisplayObject#_enabledFilters
Protected
_heightThe height of the sprite (this is initially set by the texture)
PIXI.Sprite#_height
Protected
_lastWhich index in the children array the display component was before the previous zIndex sort. Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.
PIXI.DisplayObject#_lastSortedIndex
Local bounds object, swapped with _bounds
when using getLocalBounds()
.
PIXI.DisplayObject#_localBounds
Protected
_localCache of this display-object's local-bounds rectangle.
PIXI.DisplayObject#_localBoundsRect
Protected
_maskThe original, cached mask of the object.
PIXI.DisplayObject#_mask
The resolution / device pixel ratio of the canvas. This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.
PIXI.Text#_resolution
1
Protected
_tempProtected
_widthThe width of the sprite (this is initially set by the texture)
PIXI.Sprite#_width
Protected
_zThe zIndex of the displayObject. A higher value will mean it will be rendered on top of other displayObjects within the same container.
PIXI.DisplayObject#_zIndex
Flag for if the object is accessible. If true AccessibilityManager will overlay a shadow div with attributes set
PIXI.DisplayObject#
Setting to false will prevent any children inside this container to be accessible. Defaults to true.
PIXI.DisplayObject#
true
Sets the aria-label attribute of the shadow div
PIXI.DisplayObject#
Specify the pointer-events the accessible div will use Defaults to auto.
PIXI.DisplayObject#
'auto'
Sets the title attribute of the shadow div If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'
PIXI.DisplayObject#
Specify the type of div the accessible layer is. Screen readers treat the element differently depending on this type. Defaults to button.
PIXI.DisplayObject#
'button'
The opacity of the object.
PIXI.DisplayObject#alpha
The anchor sets the origin point of the sprite. The default value is taken from the PIXI.Texture|Texture and passed to the constructor.
The default is (0,0)
, this means the sprite's origin is the top left.
Setting the anchor to (0.5,0.5)
means the sprite's origin is centered.
Setting the anchor to (1,1)
would mean the sprite's origin point will be the bottom right corner.
If you pass only single parameter, it will set both x and y to the same value as shown in the example below.
const sprite = new PIXI.Sprite(texture);
sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).
The angle of the object in degrees. 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
The blend mode to be applied to the sprite. Apply a value of PIXI.BLEND_MODES.NORMAL
to reset the blend mode.
PIXI.Sprite#blendMode
PIXI.BLEND_MODES.NORMAL
PIXI.BLEND_MODES
If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive
Setting this changes the 'cursor' property to 'pointer'
.
const sprite = new PIXI.Sprite(texture);
sprite.interactive = true;
sprite.buttonMode = true;
PIXI.DisplayObject#
Set this to true if you want this display object to be cached as a bitmap.
This basically takes a snap shot of the display object as it is at that moment. It can
provide a performance benefit for complex static displayObjects.
To remove simply set this property to false
IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear.
PIXI.DisplayObject#
The canvas element that everything is drawn to
PIXI.Text#canvas
Readonly
childrenThe array of children of this container.
PIXI.Container#children
The canvas 2d context that everything is drawn with
PIXI.Text#context
This defines what cursor mode is used when the mouse cursor is hovered over the displayObject.
const sprite = new PIXI.Sprite(texture);
sprite.interactive = true;
sprite.cursor = 'wait';
https://developer.mozilla.org/en/docs/Web/CSS/cursor
PIXI.DisplayObject#
The area the filter is applied to. This is used as more of an optimization rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.
Also works as an interaction mask.
PIXI.DisplayObject#filterArea
Sets the filters for the displayObject.
'null'
.PIXI.DisplayObject#filters
The height of the Text, setting this will actually modify the scale to achieve the value set
Interaction shape. Children will be hit first, then this shape will be checked. Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds.
const sprite = new PIXI.Sprite(texture);
sprite.interactive = true;
sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100);
PIXI.DisplayObject#
Enable interaction events for the DisplayObject. Touch, pointer and mouse
events will not be emitted unless interactive
is set to true
.
const sprite = new PIXI.Sprite(texture);
sprite.interactive = true;
sprite.on('tap', (event) => {
//handle event
});
PIXI.DisplayObject#
Determines if the children to the displayObject can be clicked/touched
Setting this to false allows PixiJS to bypass a recursive hitTest
function
PIXI.Container#
Does any other displayObject use this object as a mask?
PIXI.DisplayObject#isMask
used to fast check if a sprite is.. a sprite!
PIXI.Sprite#isSprite
Readonly
localCurrent transform of the object based on local factors: position, scale, other stuff.
Sets a mask for the displayObject. A mask is an object that limits the visibility of an
object to the shape of the mask applied to it. In PixiJS a regular mask must be a
PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it
utilities shape clipping. To remove a mask, set this property to null
.
For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.
const graphics = new PIXI.Graphics();
graphics.beginFill(0xFF3300);
graphics.drawRect(50, 250, 100, 100);
graphics.endFill();
const sprite = new PIXI.Sprite(texture);
sprite.mask = graphics;
At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.
The instance name of the object.
PIXI.DisplayObject#
name
The display object container that contains this display object.
PIXI.DisplayObject#parent
The pivot point of the displayObject that it rotates around. Assignment by value since pixi-v4.
Plugin that is responsible for rendering this element. Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.
PIXI.Sprite#pluginName
'batch'
The coordinate of the object relative to the local coordinates of the parent. Assignment by value since pixi-v4.
Can this object be rendered, if false the object will not be drawn but the updateTransform methods will still be called.
Only affects recursive calls from parent. You can ask for bounds manually.
PIXI.DisplayObject#renderable
The resolution / device pixel ratio of the canvas. This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.
1
The rotation of the object in radians. 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. Advantages can include sharper image quality (like text) and faster rendering on canvas. The main disadvantage is movement of objects may appear less smooth. To set the global default, change PIXI.settings.ROUND_PIXELS
false
The scale factor of the object. Assignment by value since pixi-v4.
The skew factor for the object in radians. Assignment by value since pixi-v4.
Should children be sorted by zIndex at the next updateTransform call. Will get automatically set to true if a new child is added, or if a child's zIndex changes.
PIXI.Container#sortDirty
If set to true, the container will sort its children by zIndex value when updateTransform() is called, or manually if sortChildren() is called.
This actually changes the order of elements in the array, so should be treated as a basic solution that is not performant compared to other solutions, such as
https://github.com/pixijs/pixi-display
Also be aware of that this may not work nicely with the addChildAt() function, as the zIndex sorting may cause the child to automatically sorted to another position.
PIXI.settings.SORTABLE_CHILDREN
PIXI.Container#sortableChildren
Set the style of the text. Set up an event listener to listen for changes on the style object and mark the text as dirty.
Set the copy for the text object. To split a line you can use '\n'.
The texture that the sprite is using
The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.
0xFFFFFF
World transform and local transform of this object. This will become read-only later, please do not assign anything there unless you know what are you doing.
PIXI.DisplayObject#transform
The visibility of the object. If false the object will not be drawn, and the updateTransform function will not be called.
Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.
PIXI.DisplayObject#visible
The width of the Text, setting this will actually modify the scale to achieve the value set
Readonly
worldThe multiplied alpha of the displayObject.
PIXI.DisplayObject#worldAlpha
Readonly
worldCurrent transform of the object based on world (parent) factors.
Readonly
worldIndicates if the object is globally visible.
The position of the displayObject on the x axis relative to the local coordinates of the parent. An alias to position.x
The position of the displayObject on the y axis relative to the local coordinates of the parent. An alias to position.y
The zIndex of the displayObject. If a container has the sortableChildren property set to true, children will be automatically sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, and thus rendered on top of other displayObjects within the same container.
Protected
_calculateProtected
_onProtected
_renderAdds one or more children to the container.
Multiple items can be added like so: myContainer.addChild(thingOne, thingTwo, thingThree)
Rest
...children: TChildrenThe DisplayObject(s) to add to the container
The first child that was added.
Optional
context: anyOptional
context: anyDestroys this text object. Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as the majority of the time the texture will not be shared with any other Sprites.
Optional
options: { Options parameter. A boolean will act as if all options have been set to that value
Optional
baseShould it destroy the base texture of the sprite as well
Optional
children?: booleanif set to true, all the children will have their destroy method called as well. 'options' will be passed on to those calls.
Optional
texture?: booleanShould it destroy the current texture of the sprite as well
Retrieves the bounds of the displayObject as a rectangle object.
Optional
skipUpdate: booleanSetting to true
will stop the transforms of the scene graph from
being updated. This means the calculation returned MAY be out of date BUT will give you a
nice performance boost.
Optional
rect: RectangleOptional rectangle to store the result of the bounds calculation.
The rectangular bounding area.
Returns the display object in the container.
Recursive searches are done in a preorder traversal.
Instance name.
Optional
deep: booleanWhether to search recursively
The child with the specified name.
getChildByName
PIXI.Container#
Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.
Optional
point: PointThe point to write the global value to.
Optional
skipUpdate: booleanSetting to true will stop the transforms of the scene graph from being updated. This means the calculation returned MAY be out of date BUT will give you a nice performance boost.
The updated point.
getGlobalPosition
PIXI.DisplayObject#
Protected
onRemoves all children from this container that are within the begin and end indexes.
Optional
beginIndex: numberThe beginning position.
Optional
endIndex: numberThe ending position. Default value is size of the container.
List of removed children
Optional
fn: ((event) => void)Optional
context: anyOptional
fn: FunctionOptional
context: anyProtected
renderConvenience function to set the position, scale, skew and pivot at once.
Optional
x: numberThe X position
Optional
y: numberThe Y position
Optional
scaleX: numberThe X scale value
Optional
scaleY: numberThe Y scale value
Optional
rotation: numberThe rotation
Optional
skewX: numberThe X skew value
Optional
skewY: numberThe Y skew value
Optional
pivotX: numberThe X pivot value
Optional
pivotY: numberThe Y pivot value
The DisplayObject instance
Calculates the global position of the display object.
The world origin to calculate from.
Optional
point: PointA Point object in which to store the value, optional (otherwise will create a new Point).
Optional
skipUpdate: booleanShould we skip the update transform.
A point object representing the position of this object.
Calculates the local position of the display object relative to another point.
The world origin to calculate from.
Optional
from: DisplayObjectThe DisplayObject to calculate the global position from.
Optional
point: PointA Point object in which to store the value, optional (otherwise will create a new Point).
Optional
skipUpdate: booleanShould we skip the update transform
A point object representing the position of this object
Renders text to its canvas, and updates its texture. By default this is used internally to ensure the texture is correct before rendering, but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text, and then shared across multiple Sprites.
Whether to abort updating the text if the Text isn't dirty and the function is called.
Static
fromHelper function that creates a new sprite based on the source you provide. The source can be - frame id, image url, video url, canvas element, video element, base texture
Source to create texture from
Optional
options: anySee PIXI.BaseTexture's constructor for options.
The newly created sprite
Static
mixinGenerated using TypeDoc
inherited PIXI.Text