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.
If the object has been destroyed via destroy(). If true, it should not be used.
Currently enabled filters
Current fill style
Current hole mode is enabled.
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.
Current line style
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.
Current shape transform matrix.
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 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.
Update dirty for limiting calculating batches.
Update dirty for limiting calculating tints for batches.
A collections of batches! These can be drawn by the renderer batch system.
The blend mode to be applied to the graphic shape. 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'
.
When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite. This is useful if your graphics element does not change often, as it will speed up the rendering of the object in exchange for taking up texture memory. It is also useful if you need the graphics object to be anti-aliased, because it will be rendered using canvas. This is not recommended if you are constantly redrawing the graphics element.
The array of children of this container.
Current path
This defines what cursor mode is used when the mouse cursor is hovered over the displayObject.
The current fill style.
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'
.Includes vertex positions, face indices, normals, colors, UVs, and custom attributes within buffers, reducing the cost of passing all this data to the GPU. Can be shared between multiple Mesh or Graphics objects.
The height of the Container, 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!
The current line style.
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.
Renderer plugin for batching
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.
The scale factor of the object. Assignment by value since pixi-v4.
Represents the vertex and fragment shaders that processes the geometry and runs on the GPU. Can be shared between multiple Graphics objects.
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.
Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., blend mode, culling, depth testing, direction of rendering triangles, backface, etc.
The tint applied to the graphic shape. 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.
Copy of the object vertex data.
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 Container, 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.
Retrieves the bounds of the graphic shape as a rectangle object
Initialize the curve
Populating batches for rendering
Recursively updates transform of all objects from the root to this one internal function for toLocal()
Renders the object using the WebGL renderer
The renderer
Renders the batches using the BathedRenderer plugin
The renderer
Renders the graphics direct
The renderer
Renders specific DrawCall
Resolves shader for direct rendering
The renderer
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.
The arc method creates an arc/curve (used to create circles, or parts of circles).
The x-coordinate of the center of the circle
The y-coordinate of the center of the circle
The radius of the circle
The starting angle, in radians (0 is at the 3 o'clock position of the arc's circle)
The ending angle, in radians
This Graphics object. Good for chaining method calls
The arcTo() method creates an arc/curve between two tangents on the canvas.
"borrowed" from https://code.google.com/p/fxcanvas/ - thanks google!
The x-coordinate of the first tangent point of the arc
The y-coordinate of the first tangent point of the arc
The x-coordinate of the end of the arc
The y-coordinate of the end of the arc
The radius of the arc
This Graphics object. Good for chaining method calls
Specifies a simple one-color fill that subsequent calls to other Graphics methods (such as lineTo() or drawCircle()) use when drawing.
This Graphics object. Good for chaining method calls
Begin adding holes to the last draw shape
IMPORTANT: holes must be fully inside a shape to work
Also weirdness ensues if holes overlap!
Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer,
please use moveTo
lineTo
, quadraticCurveTo
if you rely on pixi-legacy bundle.
Returns itself.
Begin the texture fill
This Graphics object. Good for chaining method calls
Calculate the points for a bezier curve and then draws it.
Control point x
Control point y
Second Control point x
Second Control point y
Destination point x
Destination point y
This Graphics object. Good for chaining method calls
Recalculates the bounds of the container.
Recalcuate the tint by applying tin to batches using Graphics tint.
If there's a transform update or a change to the shape of the geometry, recaculate the vertices.
Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.
This Graphics object. Good for chaining method calls
Creates a new Graphics object with the same values as this one. Note that only the geometry of the object is cloned, not its transform (position,scale,etc)
A clone of the graphics object
Closes the current path.
Returns itself.
Container default updateTransform, does update children of container. Will crash if there's no parent element.
Tests if a point is inside this graphics object
the point to test
the result of the test
Destroys the Graphics object.
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.
Draw Rectangle with chamfer corners.
Note: Only available with @pixi/graphics-extras.
Upper left corner of rect
Upper right corner of rect
Width of rect
Height of rect
accept negative or positive values
Returns self.
Draws a circle.
The X coordinate of the center of the circle
The Y coordinate of the center of the circle
The radius of the circle
This Graphics object. Good for chaining method calls
Draws an ellipse.
The X coordinate of the center of the ellipse
The Y coordinate of the center of the ellipse
The half width of the ellipse
The half height of the ellipse
This Graphics object. Good for chaining method calls
Draw Rectangle with fillet corners.
Note: Only available with @pixi/graphics-extras.
Upper left corner of rect
Upper right corner of rect
Width of rect
Height of rect
non-zero real number, size of corner cutout
Returns self.
Draws a polygon using the given path.
The path data used to construct the polygon.
This Graphics object. Good for chaining method calls
Draws a rectangle shape.
The X coord of the top-left of the rectangle
The Y coord of the top-left of the rectangle
The width of the rectangle
The height of the rectangle
This Graphics object. Good for chaining method calls
Draw a regular polygon where all sides are the same length.
Note: Only available with @pixi/graphics-extras.
X position
Y position
Polygon radius
Minimum value is 3
Starting rotation values in radians..
Draw a rectangle shape with rounded/beveled corners.
The X coord of the top-left of the rectangle
The Y coord of the top-left of the rectangle
The width of the rectangle
The height of the rectangle
Radius of the rectangle corners
This Graphics object. Good for chaining method calls
Draw any shape.
Shape to draw
This Graphics object. Good for chaining method calls
Draw a star shape with an arbitrary number of points.
Center X position of the star
Center Y position of the star
The number of points of the star, must be > 1
The outer radius of the star
This Graphics object. Good for chaining method calls
Draw a torus shape, like a donut. Can be used for something like a circle loader.
Note: Only available with @pixi/graphics-extras.
X position
Y position
Inner circle radius
Outer circle radius
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
Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.
This Graphics object. Good for chaining method calls
End adding holes to the last draw shape
Returns itself.
Return an array listing the events for which the emitter has registered listeners.
Finish the polygon object.
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
Retrieves the local bounds of the displayObject as a rectangle object.
The rectangular bounding area.
True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and masked with gl.scissor.
True if only 1 rect.
Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() method or the drawCircle() method.
This Graphics object. Good for chaining method calls
Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() method or the drawCircle() method.
This Graphics object. Good for chaining method calls
Like line style but support texture for line fill.
This Graphics object. Good for chaining method calls
Draws a line using the current line style from the current drawing position to (x, y); The current drawing position is then set to (x, y).
the X coordinate to draw to
the Y coordinate to draw to
This Graphics object. Good for chaining method calls
Return the number of listeners listening to a given event.
The event name.
Return the listeners registered for a given event.
The event name.
Moves the current drawing position to x, y.
the X coordinate to move to
the Y coordinate to move to
This Graphics object. Good for chaining method calls
Overridable method that can be used by Container subclasses whenever the children array is modified
Calculate the points for a quadratic bezier curve and then draws it. Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
Control point x
Control point y
Destination point x
Destination point y
This Graphics object. Good for chaining method calls
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
Apply a matrix to the positional data.
Matrix to use for transform current shape.
Returns itself.
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.
Start a polygon object internally
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
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.Graphics