1681-engine / index / Graphics
Class: Graphics ​
Defined in: src/core/Graphics.ts:13
Immediate-mode vector drawing with a current fill and line style (fillStyle + fillRect), on top of Pixi's shape-then-fill Graphics. Wrapped rather than subclassed: Pixi's Graphics owns fillStyle as a property.
Extends ​
Container<ContainerChild,this> &GameObjectMembers<this>
Extended by ​
Constructors ​
Constructor ​
new Graphics(): Graphics;Defined in: src/core/Graphics.ts:18
Returns ​
Graphics
Overrides ​
GameObject(Container).constructorProperties ​
active ​
readonly active: boolean;Defined in: src/core/gameObject.ts:42
False once destroyed.
Inherited from ​
GameObject(Container).activedepth ​
depth: number;Defined in: src/core/gameObject.ts:44
The draw order in the world layer (zIndex): bigger is in front.
Inherited from ​
GameObject(Container).depthflipX ​
flipX: boolean;Defined in: src/core/gameObject.ts:48
Inherited from ​
GameObject(Container).flipXflipY ​
flipY: boolean;Defined in: src/core/gameObject.ts:49
Inherited from ​
GameObject(Container).flipYscaleX ​
scaleX: number;Defined in: src/core/gameObject.ts:46
Scale without the flip: stays positive on a mirrored sprite.
Inherited from ​
GameObject(Container).scaleXscaleY ​
scaleY: number;Defined in: src/core/gameObject.ts:47
Inherited from ​
GameObject(Container).scaleYscene ​
scene: Stage;Defined in: src/core/gameObject.ts:40
Inherited from ​
GameObject(Container).sceneMethods ​
beginPath() ​
beginPath(): this;Defined in: src/core/Graphics.ts:84
Returns ​
this
clear() ​
clear(): this;Defined in: src/core/Graphics.ts:33
Returns ​
this
clearTint() ​
clearTint(): this;Defined in: src/core/gameObject.ts:64
Returns ​
this
Inherited from ​
GameObject(Container).clearTintclosePath() ​
closePath(): this;Defined in: src/core/Graphics.ts:99
Returns ​
this
destroy() ​
Call Signature ​
destroy(options?): void;Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1343
Removes all internal references and listeners as well as removes children from the display list. Do not use a Container after calling destroy.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
options? | DestroyOptions | Options parameter. A boolean will act as if all options have been set to that value |
Returns ​
void
Example ​
container.destroy();
container.destroy(true);
container.destroy({ children: true });
container.destroy({ children: true, texture: true, textureSource: true });Inherited from ​
GameObject(Container).destroyCall Signature ​
destroy(): void;Defined in: src/core/gameObject.ts:67
Returns ​
void
Inherited from ​
GameObject(Container).destroyfillCircle() ​
fillCircle(
x,
y,
r
): this;Defined in: src/core/Graphics.ts:53
Parameters ​
| Parameter | Type |
|---|---|
x | number |
y | number |
r | number |
Returns ​
this
fillEllipse() ​
fillEllipse(
x,
y,
w,
h
): this;Defined in: src/core/Graphics.ts:43
Parameters ​
| Parameter | Type |
|---|---|
x | number |
y | number |
w | number |
h | number |
Returns ​
this
fillPath() ​
fillPath(): this;Defined in: src/core/Graphics.ts:104
Returns ​
this
fillPoints() ​
fillPoints(points, _closeShape?): this;Defined in: src/core/Graphics.ts:68
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
points | Vec2[] | undefined |
_closeShape | boolean | true |
Returns ​
this
fillRect() ​
fillRect(
x,
y,
w,
h
): this;Defined in: src/core/Graphics.ts:38
Parameters ​
| Parameter | Type |
|---|---|
x | number |
y | number |
w | number |
h | number |
Returns ​
this
fillStyle() ​
fillStyle(color, alpha?): this;Defined in: src/core/Graphics.ts:23
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
color | number | undefined |
alpha | number | 1 |
Returns ​
this
lineBetween() ​
lineBetween(
x1,
y1,
x2,
y2
): this;Defined in: src/core/Graphics.ts:63
Parameters ​
| Parameter | Type |
|---|---|
x1 | number |
y1 | number |
x2 | number |
y2 | number |
Returns ​
this
lineStyle() ​
lineStyle(
width,
color,
alpha?
): this;Defined in: src/core/Graphics.ts:28
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
width | number | undefined |
color | number | undefined |
alpha | number | 1 |
Returns ​
this
lineTo() ​
lineTo(x, y): this;Defined in: src/core/Graphics.ts:94
Parameters ​
| Parameter | Type |
|---|---|
x | number |
y | number |
Returns ​
this
moveTo() ​
moveTo(x, y): this;Defined in: src/core/Graphics.ts:89
Parameters ​
| Parameter | Type |
|---|---|
x | number |
y | number |
Returns ​
this
setAlpha() ​
setAlpha(a?): this;Defined in: src/core/gameObject.ts:55
Parameters ​
| Parameter | Type |
|---|---|
a? | number |
Returns ​
this
Inherited from ​
GameObject(Container).setAlphasetAngle() ​
setAngle(a?): this;Defined in: src/core/gameObject.ts:59
Parameters ​
| Parameter | Type |
|---|---|
a? | number |
Returns ​
this
Inherited from ​
GameObject(Container).setAnglesetBlendMode() ​
setBlendMode(mode): this;Defined in: src/core/gameObject.ts:60
Parameters ​
| Parameter | Type |
|---|---|
mode | BLEND_MODES |
Returns ​
this
Inherited from ​
GameObject(Container).setBlendModesetDepth() ​
setDepth(d): this;Defined in: src/core/gameObject.ts:54
Parameters ​
| Parameter | Type |
|---|---|
d | number |
Returns ​
this
Inherited from ​
GameObject(Container).setDepthsetFlip() ​
setFlip(x, y): this;Defined in: src/core/gameObject.ts:53
Parameters ​
| Parameter | Type |
|---|---|
x | boolean |
y | boolean |
Returns ​
this
Inherited from ​
GameObject(Container).setFlipsetFlipX() ​
setFlipX(v): this;Defined in: src/core/gameObject.ts:51
Parameters ​
| Parameter | Type |
|---|---|
v | boolean |
Returns ​
this
Inherited from ​
GameObject(Container).setFlipXsetFlipY() ​
setFlipY(v): this;Defined in: src/core/gameObject.ts:52
Parameters ​
| Parameter | Type |
|---|---|
v | boolean |
Returns ​
this
Inherited from ​
GameObject(Container).setFlipYsetPosition() ​
setPosition(x?, y?): this;Defined in: src/core/gameObject.ts:57
Parameters ​
| Parameter | Type |
|---|---|
x? | number |
y? | number |
Returns ​
this
Inherited from ​
GameObject(Container).setPositionsetRotation() ​
setRotation(r?): this;Defined in: src/core/gameObject.ts:58
Parameters ​
| Parameter | Type |
|---|---|
r? | number |
Returns ​
this
Inherited from ​
GameObject(Container).setRotationsetScale() ​
setScale(x, y?): this;Defined in: src/core/gameObject.ts:50
Parameters ​
| Parameter | Type |
|---|---|
x | number |
y? | number |
Returns ​
this
Inherited from ​
GameObject(Container).setScalesetScrollFactor() ​
setScrollFactor(f): this;Defined in: src/core/gameObject.ts:66
0 pins the object to the screen instead of the world.
Parameters ​
| Parameter | Type |
|---|---|
f | number |
Returns ​
this
Inherited from ​
GameObject(Container).setScrollFactorsetTint() ​
setTint(color?): this;Defined in: src/core/gameObject.ts:61
Parameters ​
| Parameter | Type |
|---|---|
color? | number |
Returns ​
this
Inherited from ​
GameObject(Container).setTintsetTintFill() ​
setTintFill(color): this;Defined in: src/core/gameObject.ts:63
Paints every opaque pixel in one solid colour (hit flash, silhouettes).
Parameters ​
| Parameter | Type |
|---|---|
color | number |
Returns ​
this
Inherited from ​
GameObject(Container).setTintFillsetVisible() ​
setVisible(v): this;Defined in: src/core/gameObject.ts:56
Parameters ​
| Parameter | Type |
|---|---|
v | boolean |
Returns ​
this
Inherited from ​
GameObject(Container).setVisibleslice() ​
slice(
x,
y,
r,
start,
end,
anticlockwise?
): this;Defined in: src/core/Graphics.ts:79
A pie slice from the centre, for cone telegraphs.
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
x | number | undefined |
y | number | undefined |
r | number | undefined |
start | number | undefined |
end | number | undefined |
anticlockwise | boolean | false |
Returns ​
this
strokeCircle() ​
strokeCircle(
x,
y,
r
): this;Defined in: src/core/Graphics.ts:58
Parameters ​
| Parameter | Type |
|---|---|
x | number |
y | number |
r | number |
Returns ​
this
strokeEllipse() ​
strokeEllipse(
x,
y,
w,
h
): this;Defined in: src/core/Graphics.ts:48
Parameters ​
| Parameter | Type |
|---|---|
x | number |
y | number |
w | number |
h | number |
Returns ​
this
strokePath() ​
strokePath(): this;Defined in: src/core/Graphics.ts:109
Returns ​
this
strokePoints() ​
strokePoints(points, closeShape?): this;Defined in: src/core/Graphics.ts:73
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
points | Vec2[] | undefined |
closeShape | boolean | false |
Returns ​
this