Skip to content

Graphics

Unofficial

Graphics class for drawing shapes.

Import:

import type { Graphics } from '@obsidian-typings/obsidian-public-latest';

Signature:

export class Graphics extends Container

Extends: Container

Properties

PropertyTypeDescription
alphanumberAlpha (opacity).
(Inherited from Container)
anglenumberRotation angle in degrees.
(Inherited from Container)
childrenT[]Children of this container (read-only).
(Inherited from Container)
cursornull | stringCursor style when hovering.
(Inherited from Container)
eventModePixiEventModeHow the object takes part in the federated event system.
(Inherited from Container)
hitAreaIHitArea | nullHit area shape.
(Inherited from Container)
interactivebooleanWhether the object is interactive.
(Inherited from Container)
namenull | stringDisplay name.
(Inherited from Container)
parentContainerParent container.
(Inherited from Container)
renderablebooleanWhether the object is renderable.
(Inherited from Container)
rotationnumberRotation in radians.
(Inherited from Container)
sortableChildrenbooleanWhether children should be sorted by zIndex.
(Inherited from Container)
sortDirtybooleanWhether the children need sorting.
(Inherited from Container)
transformTransformTransform data.
(Inherited from Container)
visiblebooleanWhether the object is visible.
(Inherited from Container)
worldAlphanumberAlpha relative to the scene.
(Inherited from Container)
worldTransformMatrixWorld transform matrix (read-only).
(Inherited from Container)
worldVisiblebooleanWhether the object is visible in the scene (read-only).
(Inherited from Container)
xnumberX position.
(Inherited from Container)
ynumberY position.
(Inherited from Container)
zIndexnumberZ-index for sorting.
(Inherited from Container)

Methods

MethodReturnsDescription
addChild(children?)U[0]Adds one or more children to the container.
(Inherited from Container)
addChildAt(child, index)UAdds a child at a specific index.
(Inherited from Container)
arc(cx, cy, radius, startAngle, endAngle, anticlockwise?)thisDraws an arc.
arcTo(x1, y1, x2, y2, radius)thisDraws an arc between two tangent lines.
beginFill(color?, alpha?)thisBegins filling a shape with color.
bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY)thisDraws a cubic bezier curve.
clear()thisClears all drawn graphics.
clone()GraphicsClones this graphics object.
closePath()thisCloses the current path.
destroy(options?)voidDestroys this graphics object.
drawCircle(x, y, radius)thisDraws a circle.
drawEllipse(x, y, width, height)thisDraws an ellipse.
drawRect(x, y, width, height)thisDraws a rectangle.
drawRoundedRect(x, y, width, height, radius)thisDraws a rounded rectangle.
emit(event, args?)booleanEmits an event.
(Inherited from Container)
endFill()thisEnds filling a shape.
getBounds(skipUpdate?, rect?)PixiRectangleReturns the bounds of the object.
(Inherited from Container)
getChildAt(index)TReturns the child at the given index.
(Inherited from Container)
getChildIndex(child)numberReturns the index of a child.
(Inherited from Container)
getLocalBounds(rect?)PixiRectangleReturns the local bounds of the object.
(Inherited from Container)
lineStyle(width, color?, alpha?, alignment?, native?)thisSets the line style.
lineTo(x, y)thisDraws a line to a point.
moveTo(x, y)thisMoves the drawing cursor to a point.
off(event, fn?, context?)thisRemoves an event listener.
(Inherited from Container)
on(event, fn, context?)thisAdds an event listener.
(Inherited from Container)
once(event, fn, context?)thisAdds a one-time event listener.
(Inherited from Container)
quadraticCurveTo(cpX, cpY, toX, toY)thisDraws a quadratic bezier curve.
removeAllListeners(event?)thisRemoves 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)TRemoves the child at a specific index.
(Inherited from Container)
removeChildren(beginIndex?, endIndex?)T[]Removes children from the container.
(Inherited from Container)
setChildIndex(child, index)voidSets the index of a child.
(Inherited from Container)
sortChildren()voidSorts the children by zIndex.
(Inherited from Container)
toGlobal(position, point?, skipUpdate?)PConverts a point to global (screen) coordinates.
(Inherited from Container)
toLocal(position, from?, point?, skipUpdate?)PConverts a point to local coordinates.
(Inherited from Container)