CircleGraphics
graphics/circle-graphics.ts:24 Extends AbstractGraphics<PixiGraphics>
Renders a filled Circle centered on the host's position. The circle geometry is positionless — its placement on screen comes from the host WorldObject's transform, synced once per frame by AbstractGraphics.
Example
import { Circle, CircleGraphics } from '@arcade2d/engine';
world.createObject({
components: ({ object }) => ({
graphics: () => new CircleGraphics(object, new Circle(16), 0xff00aa),
}),
});Constructors
constructor(host: WorldObject, circle: Circle, fill: number): CircleGraphics Parameters
-
hostWorldObject -
circleCircle -
fillnumber
Properties
circle: Circle The circle shape to draw. Stored as-is for inspection; mutating the original (it has no public mutators, but cloning rules still apply) does not retroactively redraw the component.
enabled: boolean Per-component gate on the three update hooks (onPreUpdate,
onUpdate, onPostUpdate). When explicitly false, the engine skips
all three for this component during the host's tick — useful for
temporarily pausing behaviour (e.g. a freeze powerup) without removing
the component and losing its internal state.
Does not gate onAdded or onDestroy; those always fire so a host can
never end up with a half-attached component.
host: WorldObject The host this component is attached to. Stored read-only;
subclasses access it as this.host directly, or through the
tier-appropriate aliases (this.world, this.game) on the per-tier
abstract bases.
Accessors
game: Game The Game the host's world belongs to. Always non-null —
the world's game field is a mandatory construction argument, not
an option.
raw: T Direct access to the underlying Pixi display object.
Use with care. raw is an intentional escape hatch for cases the
arcade2d API doesn't cover — custom shaders, filter chains, advanced
blend modes, mask assignment, world-space bounds queries, anything we
haven't decided how to model yet. Code that touches raw is coupled to
Pixi's public API and may break when:
- arcade2d upgrades Pixi (including minor versions).
- Pixi itself ships a breaking change.
- arcade2d swaps Pixi for a different renderer.
None of those will be treated as breaking changes to arcade2d's own
surface. Prefer the typed methods on this component; reach for raw
only when no equivalent exists, and isolate the access behind your own
helper so the coupling is in one place.
Methods
containsWorldPoint(point: PointPrimitive): boolean Returns true if the given world-space point lies inside this
circle, accounting for the host's position, rotation, and scale.
Composes WorldObject.worldToLocal with the underlying
Circle.containsPoint; under non-uniform scale, the test
becomes against the scaled shape (the local point's coordinates are
divided per-axis), which matches what's drawn on screen.
Parameters
-
pointPointPrimitive
Returns
boolean onAdded(): void Lifecycle hook that is called when the component is added to the host object. Should not be called directly.
Returns
void onDestroy(): void Lifecycle hook that is called when the host object is destroyed. Should not be called directly.
Returns
void onPostUpdate(): void Returns
void onUpdate(_update: WorldUpdate, _deps: Record): void Lifecycle hook for the main update phase. Called once per world
tick, after every component's onPreUpdate and before any
onPostUpdate.
Parameters
-
_updateWorldUpdate -
_depsRecord
Returns
void