The bounds object, this is used to calculate and store the bounds of the displayObject.
Flags the cached bounds as dirty.
Cache of this display-object's bounds-rectangle.
Cached tint value so we can tell when the tint is changed. Value is used for 2d CanvasRenderer.
If the object has been destroyed via destroy(). If true, it should not be used.
Currently enabled filters
The height of the sprite (this is initially set by the texture)
Which 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.
Local bounds object, swapped with _bounds
when using getLocalBounds()
.
Cache of this display-object's local-bounds rectangle.
The original, cached mask of the object.
The width of the sprite (this is initially set by the texture)
The zIndex of the displayObject. A higher value will mean it will be rendered on top of other displayObjects within the same container.
Flag for if the object is accessible. If true AccessibilityManager will overlay a shadow div with attributes set
Setting to false will prevent any children inside this container to be accessible. Defaults to true.
Sets the aria-label attribute of the shadow div
Specify the pointer-events the accessible div will use Defaults to auto.
Sets the title attribute of the shadow div If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'
Specify the type of div the accessible layer is. Screen readers treat the element differently depending on this type. Defaults to button.
The opacity of the object.
The anchor sets the origin point of the sprite. The default value is taken from the {@link 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.
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.
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'
.
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.
The array of children of this container.
This defines what cursor mode is used when the mouse cursor is hovered over the 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.
Sets the filters for the displayObject.
'null'
.The height of the sprite, 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.
Enable interaction events for the DisplayObject. Touch, pointer and mouse
events will not be emitted unless interactive
is set to true
.
Determines if the children to the displayObject can be clicked/touched
Setting this to false allows PixiJS to bypass a recursive hitTest
function
Does any other displayObject use this object as a mask?
used to fast check if a sprite is.. a sprite!
Current 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
{@link PIXI.Graphics} or a {@link 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.
The instance name of the object.
The display object container that contains this display object.
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.
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.
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 {@link PIXI.settings.ROUND_PIXELS}
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.
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 @link 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.
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.
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.
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.
The width of the sprite, setting this will actually modify the scale to achieve the value set
The multiplied alpha of the displayObject.
Current transform of the object based on world (parent) factors.
Indicates 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.
Updates the bounds of the sprite.
When the texture is updated, this event will fire to update the scale and frame
Recursively updates transform of all objects from the root to this one internal function for toLocal()
Renders the object using the WebGL renderer
The webgl renderer to use.
Adds one or more children to the container.
Multiple items can be added like so: myContainer.addChild(thingOne, thingTwo, thingThree)
The DisplayObject(s) to add to the container
The first child that was added.
Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown
The child to add
The index to place the child in
The child that was added.
Recalculates the bounds of the container.
calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData This is used to ensure that the true width and height of a trimmed texture is respected
calculates worldTransform * vertices, store it in vertexData
Container default updateTransform, does update children of container. Will crash if there's no parent element.
Tests if a point is inside this sprite
the point to test
the result of the test
Destroys this sprite and optionally its texture and children
Pair method for enableTempParent
actual parent of element
DisplayObject default updateTransform, does not update children of container. Will crash if there's no parent element.
Calls each of the listeners registered for a given event.
The event name.
Arguments that are passed to registered listeners
true
if the event had listeners, else false
.
Used in Renderer, cacheAsBitmap and other places where you call an updateTransform
on root
const cacheParent = elem.enableTempParent();
elem.updateTransform();
elem.disableTempParent(cacheParent);
current parent
Return an array listing the events for which the emitter has registered listeners.
Retrieves the bounds of the displayObject as a rectangle object.
The rectangular bounding area.
Returns the child at the specified index
The index to get the child at
The child at the given index, if any.
Returns the display object in the container.
Recursive searches are done in a preorder traversal.
Instance name.
The child with the specified name.
Returns the index position of a child DisplayObject instance
The DisplayObject instance to identify
The index position of the child display object to identify
Gets the local bounds of the sprite object.
The bounds.
Return the number of listeners listening to a given event.
The event name.
Return the listeners registered for a given event.
The event name.
Overridable method that can be used by Container subclasses whenever the children array is modified
Removes one or more children from the container.
The DisplayObject(s) to remove
The first child that was removed.
Removes a child from the specified index position.
The index to get the child from
The child that was removed.
Removes all children from this container that are within the begin and end indexes.
List of removed children
Renders the object using the WebGL renderer
The renderer
Render the object using the WebGL renderer and advanced features.
The renderer
Changes the position of an existing child in the display object container
The child DisplayObject instance for which you want to change the index number
The resulting index number for the child display object
Set the parent Container of this DisplayObject.
The Container to add this DisplayObject to.
The Container that this DisplayObject was added to.
Convenience function to set the position, scale, skew and pivot at once.
The DisplayObject instance
Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex.
Swaps the position of 2 Display Objects within this container.
First display object to swap
Second display object to swap
Calculates the local position of the display object relative to another point.
The world origin to calculate from.
A point object representing the position of this object
Updates the transform on all children of this container for rendering
Helper 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
The newly created sprite
Mixes all enumerable properties and methods from a source object to DisplayObject.
The source of properties and methods to mix in.
Generated using TypeDoc
PIXI.Sprite