Members
-
<constant> ANGLE_DOWN :integer
-
The Angle (in degrees) a Game Object needs to be set to in order to face down.
-
<constant> ANGLE_LEFT :integer
-
The Angle (in degrees) a Game Object needs to be set to in order to face left.
-
<constant> ANGLE_NORTH_EAST :integer
-
The Angle (in degrees) a Game Object needs to be set to in order to face north east.
-
<constant> ANGLE_NORTH_WEST :integer
-
The Angle (in degrees) a Game Object needs to be set to in order to face north west.
-
<constant> ANGLE_RIGHT :integer
-
The Angle (in degrees) a Game Object needs to be set to in order to face right.
-
<constant> ANGLE_SOUTH_EAST :integer
-
The Angle (in degrees) a Game Object needs to be set to in order to face south east.
-
<constant> ANGLE_SOUTH_WEST :integer
-
The Angle (in degrees) a Game Object needs to be set to in order to face south west.
-
<constant> ANGLE_UP :integer
-
The Angle (in degrees) a Game Object needs to be set to in order to face up.
-
<constant> AUTO :integer
-
AUTO renderer - picks between WebGL or Canvas based on device.
-
<constant> BITMAPDATA :integer
-
Game Object type.
-
<constant> BITMAPTEXT :integer
-
Game Object type.
-
<constant> blendModes
-
Various blend modes supported by Pixi.
IMPORTANT: The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.
- Source - Phaser.js, line 506
Properties:
Name Type Description blendModes.NORMALNumber blendModes.ADDNumber blendModes.MULTIPLYNumber blendModes.SCREENNumber blendModes.OVERLAYNumber blendModes.DARKENNumber blendModes.LIGHTENNumber blendModes.COLOR_DODGENumber blendModes.COLOR_BURNNumber blendModes.HARD_LIGHTNumber blendModes.SOFT_LIGHTNumber blendModes.DIFFERENCENumber blendModes.EXCLUSIONNumber blendModes.HUENumber blendModes.SATURATIONNumber blendModes.COLORNumber blendModes.LUMINOSITYNumber -
<constant> BOTTOM_CENTER :integer
-
A constant representing a bottom-center alignment or position.
-
<constant> BOTTOM_LEFT :integer
-
A constant representing a bottom-left alignment or position.
-
<constant> BOTTOM_RIGHT :integer
-
A constant representing a bottom-right alignment or position.
-
<constant> BUTTON :integer
-
Game Object type.
-
<constant> CANVAS :integer
-
Canvas Renderer.
-
<constant> CANVAS_FILTER :integer
-
Game Object type.
-
<constant> CENTER :integer
-
A constant representing a center alignment or position.
-
<constant> CIRCLE :integer
-
Game Object type.
-
<constant> CREATURE :integer
-
Game Object type.
-
<constant> DOWN :integer
-
Direction constant.
-
<constant> ELLIPSE :integer
-
Game Object type.
-
<constant> EMITTER :integer
-
Game Object type.
-
<constant> GAMES :array
-
An array of Phaser game instances.
-
<constant> GRAPHICS :integer
-
Game Object type.
-
<constant> GROUP :integer
-
Game Object type.
-
<constant> HEADLESS :integer
-
Headless renderer (not visual output)
-
<constant> HORIZONTAL :integer
-
A horizontal orientation
-
<constant> IMAGE :integer
-
Game Object type.
-
<constant> LANDSCAPE :integer
-
A landscape orientation
-
<constant> LEFT :integer
-
Direction constant.
-
<constant> LEFT_BOTTOM :integer
-
A constant representing a left-bottom alignment or position.
-
<constant> LEFT_CENTER :integer
-
A constant representing a left-center alignment or position.
-
<constant> LEFT_TOP :integer
-
A constant representing a left-top alignment or position.
-
<constant> LINE :integer
-
Game Object type.
-
<constant> MATRIX :integer
-
Game Object type.
-
<constant> NONE :integer
-
Direction constant.
-
<constant> PENDING_ATLAS :integer
-
Game Object type.
-
<constant> POINT :integer
-
Game Object type.
-
<constant> POINTER :integer
-
Game Object type.
-
<constant> POLYGON :integer
-
Game Object type.
-
<constant> PORTRAIT :integer
-
A portrait orientation
-
<constant> RECTANGLE :integer
-
Game Object type.
-
<constant> RENDERTEXTURE :integer
-
Game Object type.
-
<constant> RETROFONT :integer
-
Game Object type.
-
<constant> RIGHT :integer
-
Direction constant.
-
<constant> RIGHT_BOTTOM :integer
-
A constant representing a right-bottom alignment or position.
-
<constant> RIGHT_CENTER :integer
-
A constant representing a right-center alignment or position.
-
<constant> RIGHT_TOP :integer
-
A constant representing a right-top alignment or position.
-
<constant> ROPE :integer
-
Game Object type.
-
<constant> ROUNDEDRECTANGLE :integer
-
Game Object type.
-
<constant> scaleModes
-
The scale modes that are supported by Pixi.
The DEFAULT scale mode affects the default scaling mode of future operations.
It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. -
<constant> SPRITE :integer
-
Game Object type.
-
<constant> SPRITEBATCH :integer
-
Game Object type.
-
<constant> TEXT :integer
-
Game Object type.
-
<constant> TILEMAP :integer
-
Game Object type.
-
<constant> TILEMAPLAYER :integer
-
Game Object type.
-
<constant> TILESPRITE :integer
-
Game Object type.
-
<constant> TOP_CENTER :integer
-
A constant representing a top-center alignment or position.
-
<constant> TOP_LEFT :integer
-
A constant representing a top-left alignment or position.
-
<constant> TOP_RIGHT :integer
-
A constant representing a top-right alignment or position.
-
<constant> UP :integer
-
Direction constant.
-
<constant> VERSION :string
-
The Phaser version number.
-
<constant> VERTICAL :integer
-
A vertical orientation
-
<constant> VIDEO :integer
-
Game Object type.
-
<constant> WEBGL :integer
-
WebGL Renderer.
-
<constant> WEBGL_FILTER :integer
-
Game Object type.
-
<constant> WEBGL_MULTI :integer
-
WebGL Renderer with MultiTexture support enabled.
Methods
-
arc(cx, cy, radius, startAngle, endAngle, anticlockwise, segments) → {Graphics}
-
The arc method creates an arc/curve (used to create circles, or parts of circles).
Parameters:
Name Type Description cxNumber The x-coordinate of the center of the circle
cyNumber The y-coordinate of the center of the circle
radiusNumber The radius of the circle
startAngleNumber The starting angle, in radians (0 is at the 3 o'clock position of the arc's circle)
endAngleNumber The ending angle, in radians
anticlockwiseBoolean Optional. Specifies whether the drawing should be counterclockwise or clockwise. False is default, and indicates clockwise, while true indicates counter-clockwise.
segmentsNumber Optional. The number of segments to use when calculating the arc. The default is 40. If you need more fidelity use a higher number.
Returns:
Graphics -- Source - gameobjects/Graphics.js, line 650
-
beginFill(color, alpha) → {Graphics}
-
Specifies a simple one-color fill that subsequent calls to other Graphics methods
(such as lineTo() or drawCircle()) use when drawing.Parameters:
Name Type Description colorNumber the color of the fill
alphaNumber the alpha of the fill
Returns:
Graphics -- Source - gameobjects/Graphics.js, line 737
-
bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY) → {Graphics}
-
Calculate the points for a bezier curve and then draws it.
Parameters:
Name Type Description cpXNumber Control point x
cpYNumber Control point y
cpX2Number Second Control point x
cpY2Number Second Control point y
toXNumber Destination point x
toYNumber Destination point y
Returns:
Graphics -- Source - gameobjects/Graphics.js, line 519
-
clear() → {Graphics}
-
Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.
Returns:
Graphics -- Source - gameobjects/Graphics.js, line 886
-
destroyCachedSprite()
-
Destroys a previous cached sprite.
- Source - gameobjects/Graphics.js, line 1462
-
displayList(displayObject)
-
Call this function from the Dev Tools console.
It will scan the display list and output all of the Objects it finds, and their renderOrderIDs.
Note Requires a browser that supports console.group and console.groupEnd (such as Chrome)
Parameters:
Name Type Argument Description displayObjectObject <optional>
The displayObject level display object to start from. Defaults to the World.
- Source - utils/Debug.js, line 844
-
drawCircle(x, y, diameter) → {Graphics}
-
Draws a circle.
Parameters:
Name Type Description xNumber The X coordinate of the center of the circle
yNumber The Y coordinate of the center of the circle
diameterNumber The diameter of the circle
Returns:
Graphics -- Source - gameobjects/Graphics.js, line 815
-
drawEllipse(x, y, width, height) → {Graphics}
-
Draws an ellipse.
Parameters:
Name Type Description xNumber The X coordinate of the center of the ellipse
yNumber The Y coordinate of the center of the ellipse
widthNumber The half width of the ellipse
heightNumber The half height of the ellipse
Returns:
Graphics -- Source - gameobjects/Graphics.js, line 832
-
drawPolygon(path) → {Graphics}
-
Draws a polygon using the given path.
Parameters:
Name Type Description pathArray | Phaser.Polygon The path data used to construct the polygon. Can either be an array of points or a Phaser.Polygon object.
Returns:
Graphics -- Source - gameobjects/Graphics.js, line 850
-
drawRect(x, y, width, height) → {Graphics}
-
Parameters:
Name Type Description xNumber The X coord of the top-left of the rectangle
yNumber The Y coord of the top-left of the rectangle
widthNumber The width of the rectangle
heightNumber The height of the rectangle
Returns:
Graphics -- Source - gameobjects/Graphics.js, line 782
-
drawRoundedRect(x, y, width, height, radius)
-
Parameters:
Name Type Description xNumber The X coord of the top-left of the rectangle
yNumber The Y coord of the top-left of the rectangle
widthNumber The width of the rectangle
heightNumber The height of the rectangle
radiusNumber Radius of the rectangle corners. In WebGL this must be a value between 0 and 9.
- Source - gameobjects/Graphics.js, line 799
-
drawShape(shape) → {GraphicsData}
-
Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.
Parameters:
Name Type Description shapeCircle | Rectangle | Ellipse | Line | Polygon The Shape object to draw.
Returns:
GraphicsData -The generated GraphicsData object.
- Source - gameobjects/Graphics.js, line 1474
-
emit(eventName) → {Boolean}
-
Emit an event to all registered event listeners.
Parameters:
Name Type Description eventNameString The name of the event.
Returns:
Boolean -Indication if we've emitted an event.
- Source - plugins/path/EventTarget.js, line 54
-
endFill() → {Graphics}
-
Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.
Returns:
Graphics -- Source - gameobjects/Graphics.js, line 766
-
generateTexture(resolution, scaleMode, padding) → {Texture}
-
Useful function that returns a texture of the graphics object that can then be used to create sprites
This can be quite useful if your geometry is complicated and needs to be reused multiple times.Parameters:
Name Type Argument Default Description resolutionNumber <optional>
1 The resolution of the texture being generated
scaleModeNumber <optional>
0 Should be one of the PIXI.scaleMode consts
paddingNumber <optional>
0 Add optional extra padding to the generated texture (default 0)
Returns:
Texture -a texture of the graphics object
- Source - gameobjects/Graphics.js, line 908
-
getBounds() → {Rectangle}
-
Retrieves the bounds of the graphic shape as a rectangle object
Returns:
Rectangle -the rectangular bounding area
- Source - gameobjects/Graphics.js, line 1126
-
getLocalBounds() → {Rectangle}
-
Retrieves the non-global local bounds of the graphic shape as a rectangle. The calculation takes all visible children into consideration.
Returns:
Rectangle -The rectangular bounding area
- Source - gameobjects/Graphics.js, line 1216
-
lineStyle(lineWidth, color, alpha) → {Graphics}
-
Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() method or the drawCircle() method.
Parameters:
Name Type Description lineWidthNumber width of the line to draw, will update the objects stored style
colorNumber color of the line to draw, will update the objects stored style
alphaNumber alpha of the line to draw, will update the objects stored style
Returns:
Graphics -- Source - gameobjects/Graphics.js, line 388
-
lineTo(x, y) → {Graphics}
-
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).Parameters:
Name Type Description xNumber the X coordinate to draw to
yNumber the Y coordinate to draw to
Returns:
Graphics -- Source - gameobjects/Graphics.js, line 439
-
listeners(eventName) → {Array}
-
Return a list of assigned event listeners.
Parameters:
Name Type Description eventNameString The events that should be listed.
Returns:
Array -An array of listener functions
- Source - plugins/path/EventTarget.js, line 41
-
mixin(object)
-
Mixes in the properties of the EventTarget prototype onto another object
Parameters:
Name Type Description objectObject The obj to mix into
- Source - plugins/path/EventTarget.js, line 34
-
moveTo(x, y) → {Graphics}
-
Moves the current drawing position to x, y.
Parameters:
Name Type Description xNumber the X coordinate to move to
yNumber the Y coordinate to move to
Returns:
Graphics -- Source - gameobjects/Graphics.js, line 423
-
off(eventName, callback)
-
Remove event listeners.
Parameters:
Name Type Description eventNameString The event we want to remove.
callbackfunction The listener that we need to find.
- Source - plugins/path/EventTarget.js, line 143
-
on(eventName, callback)
-
Register a new EventListener for the given event.
Parameters:
Name Type Description eventNameString Name of the event.
callbackFuncton fn Callback function.
- Source - plugins/path/EventTarget.js, line 107
-
once(eventName, callback)
-
Add an EventListener that's only called once.
Parameters:
Name Type Description eventNameString Name of the event.
callbackfunction Callback function.
- Source - plugins/path/EventTarget.js, line 124
-
Phaser.Path#numPoints return {number} The total number of PathPoints in this Path.()
-
The total number of PathPoints in this Path.
- Source - plugins/path/Path.js, line 536
-
quadraticCurveTo(cpX, cpY, toX, toY) → {Graphics}
-
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-cParameters:
Name Type Description cpXNumber Control point x
cpYNumber Control point y
toXNumber Destination point x
toYNumber Destination point y
Returns:
Graphics -- Source - gameobjects/Graphics.js, line 463
-
removeAllListeners(eventName)
-
Remove all listeners or only the listeners for the specified event.
Parameters:
Name Type Description eventNameString The event you want to remove all listeners for.
- Source - plugins/path/EventTarget.js, line 173
-
set()
-
Applies a Gaussian blur to the DOM element. The value of 'radius' defines the value of the standard deviation to the Gaussian function,
or how many pixels on the screen blend into each other, so a larger value will create more blur.
If no parameter is provided, then a value 0 is used. The parameter is specified as a CSS length, but does not accept percentage values. -
set()
-
Applies a linear multiplier to input image, making it appear more or less bright.
A value of 0% will create an image that is completely black. A value of 100% leaves the input unchanged.
Other values are linear multipliers on the effect. Values of an amount over 100% are allowed, providing brighter results.
If the 'amount' parameter is missing, a value of 100% is used. -
set()
-
Adjusts the contrast of the input. A value of 0% will create an image that is completely black.
A value of 100% leaves the input unchanged. Values of amount over 100% are allowed, providing results with less contrast.
If the 'amount' parameter is missing, a value of 100% is used. -
set()
-
Applies a hue rotation on the input image. The value of 'angle' defines the number of degrees around the color circle
the input samples will be adjusted. A value of 0deg leaves the input unchanged. If the 'angle' parameter is missing,
a value of 0deg is used. Maximum value is 360deg. -
set()
-
Converts the input image to sepia. The value of 'amount' defines the proportion of the conversion.
A value of 100% is completely sepia. A value of 0 leaves the input unchanged.
Values between 0% and 100% are linear multipliers on the effect. If the 'amount' parameter is missing, a value of 100% is used. -
set()
-
Applies transparency to the samples in the input image. The value of 'amount' defines the proportion of the conversion.
A value of 0% is completely transparent. A value of 100% leaves the input unchanged.
Values between 0% and 100% are linear multipliers on the effect. This is equivalent to multiplying the input image samples by amount.
If the 'amount' parameter is missing, a value of 100% is used.
This function is similar to the more established opacity property; the difference is that with filters, some browsers provide hardware acceleration for better performance. -
set()
-
Converts the input image to grayscale. The value of 'amount' defines the proportion of the conversion.
A value of 100% is completely grayscale. A value of 0% leaves the input unchanged.
Values between 0% and 100% are linear multipliers on the effect. If the 'amount' parameter is missing, a value of 100% is used. -
set()
-
Saturates the input image. The value of 'amount' defines the proportion of the conversion.
A value of 0% is completely un-saturated. A value of 100% leaves the input unchanged.
Other values are linear multipliers on the effect. Values of amount over 100% are allowed, providing super-saturated results.
If the 'amount' parameter is missing, a value of 100% is used. -
set()
-
Inverts the samples in the input image. The value of 'amount' defines the proportion of the conversion.
A value of 100% is completely inverted. A value of 0% leaves the input unchanged.
Values between 0% and 100% are linear multipliers on the effect. If the 'amount' parameter is missing, a value of 100% is used. -
stopImmediatePropagation()
-
Stops the propagation of events to sibling listeners (no longer calls any listeners).
- Source - plugins/path/EventTarget.js, line 277
-
stopPropagation()
-
Stops the propagation of events up the scene graph (prevents bubbling).
- Source - plugins/path/EventTarget.js, line 268
-
updateLocalBounds()
-
Update the bounds of the object
- Source - gameobjects/Graphics.js, line 1283
Type Definitions
-
DisplayObject
-
A display object is any object that can be rendered in the Phaser/pixi.js scene graph.
This includes Phaser.Group (groups are display objects!),
Phaser.Sprite, Phaser.Button, Phaser.Text
as well as PIXI.DisplayObject and all derived types.- Source - core/Group.js, line 2970
