Graphics
Unofficial
Graphics class for drawing shapes.
Import:
import type { Graphics } from '@obsidian-typings/obsidian-public-latest';Signature:
export class Graphics extends ContainerExtends: Container
Properties
| Property | Type | Description | |
|---|---|---|---|
| alpha | number | Alpha (opacity). (Inherited from Container) | |
| angle | number | Rotation angle in degrees. (Inherited from Container) | |
| children | T[] | Children of this container (read-only). (Inherited from Container) | |
| cursor | null | string | Cursor style when hovering. (Inherited from Container) | |
| hitArea | IHitArea | null | Hit area shape. (Inherited from Container) | |
| interactive | boolean | Whether the object is interactive. (Inherited from Container) | |
| name | null | string | Display name. (Inherited from Container) | |
| parent | Container | Parent container. (Inherited from Container) | |
| renderable | boolean | Whether the object is renderable. (Inherited from Container) | |
| rotation | number | Rotation in radians. (Inherited from Container) | |
| sortableChildren | boolean | Whether children should be sorted by zIndex. (Inherited from Container) | |
| sortDirty | boolean | Whether the children need sorting. (Inherited from Container) | |
| transform | Transform | Transform data. (Inherited from Container) | |
| visible | boolean | Whether the object is visible. (Inherited from Container) | |
| worldAlpha | number | Alpha relative to the scene. (Inherited from Container) | |
| worldTransform | Matrix | World transform matrix (read-only). (Inherited from Container) | |
| worldVisible | boolean | Whether the object is visible in the scene (read-only). (Inherited from Container) | |
| x | number | X position. (Inherited from Container) | |
| y | number | Y position. (Inherited from Container) | |
| zIndex | number | Z-index for sorting. (Inherited from Container) |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| addChild(children?) | U[0] | Adds one or more children to the container. (Inherited from Container) | |
| addChildAt(child, index) | U | Adds a child at a specific index. (Inherited from Container) | |
| arc(cx, cy, radius, startAngle, endAngle, anticlockwise?) | this | Draws an arc. | |
| arcTo(x1, y1, x2, y2, radius) | this | Draws an arc between two tangent lines. | |
| beginFill(color?, alpha?) | this | Begins filling a shape with color. | |
| bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY) | this | Draws a cubic bezier curve. | |
| clear() | this | Clears all drawn graphics. | |
| clone() | Graphics | Clones this graphics object. | |
| closePath() | this | Closes the current path. | |
| destroy(options?) | void | Destroys this graphics object. | |
| drawCircle(x, y, radius) | this | Draws a circle. | |
| drawEllipse(x, y, width, height) | this | Draws an ellipse. | |
| drawRect(x, y, width, height) | this | Draws a rectangle. | |
| drawRoundedRect(x, y, width, height, radius) | this | Draws a rounded rectangle. | |
| emit(event, args?) | boolean | Emits an event. (Inherited from Container) | |
| endFill() | this | Ends filling a shape. | |
| getBounds(skipUpdate?, rect?) | PixiRectangle | Returns the bounds of the object. (Inherited from Container) | |
| getChildAt(index) | T | Returns the child at the given index. (Inherited from Container) | |
| getChildIndex(child) | number | Returns the index of a child. (Inherited from Container) | |
| getLocalBounds(rect?) | PixiRectangle | Returns the local bounds of the object. (Inherited from Container) | |
| lineStyle(width, color?, alpha?, alignment?, native?) | this | Sets the line style. | |
| lineTo(x, y) | this | Draws a line to a point. | |
| moveTo(x, y) | this | Moves the drawing cursor to a point. | |
| off(event, fn?, context?) | this | Removes an event listener. (Inherited from Container) | |
| on(event, fn, context?) | this | Adds an event listener. (Inherited from Container) | |
| once(event, fn, context?) | this | Adds a one-time event listener. (Inherited from Container) | |
| quadraticCurveTo(cpX, cpY, toX, toY) | this | Draws a quadratic bezier curve. | |
| removeAllListeners(event?) | this | Removes all listeners for the given event. (Inherited from Container) | |
| removeChild(children?) | U[0] | Removes one or more children from the container. (Inherited from Container) | |
| removeChildAt(index) | T | Removes the child at a specific index. (Inherited from Container) | |
| removeChildren(beginIndex?, endIndex?) | T[] | Removes children from the container. (Inherited from Container) | |
| setChildIndex(child, index) | void | Sets the index of a child. (Inherited from Container) | |
| sortChildren() | void | Sorts the children by zIndex. (Inherited from Container) | |
| toGlobal(position, point?, skipUpdate?) | P | Converts a point to global (screen) coordinates. (Inherited from Container) | |
| toLocal(position, from?, point?, skipUpdate?) | P | Converts a point to local coordinates. (Inherited from Container) |