DrawLine
A RenderNode which computes the geometry of a line segment and expands it into a quad suitable for WebGL rendering.
A line segment has two endpoints (a and b) and can have a different width at each end, allowing tapered lines. This node calculates the four corner vertices of the quad that represents the line, by offsetting perpendicular to the line direction by the respective half-widths at each end. The resulting vertices are optionally transformed by a matrix and appended to a flat vertex list.
This node is used internally by the WebGL renderer when drawing stroked paths, such as those produced by Graphics Game Objects.
Constructor
new DrawLine(manager)
Parameters
| name | type | optional | description |
|---|---|---|---|
| manager | Phaser.Renderer.WebGL.RenderNodes.RenderNodeManager | No | The manager that owns this RenderNode. |
Scope: static
Extends
Source: src/renderer/webgl/renderNodes/DrawLine.js#L10
Since: 4.0.0
Inherited Methods
From Phaser.Renderer.WebGL.RenderNodes.RenderNode:
Public Methods
run
<instance> run(drawingContext, currentMatrix, ax, ay, bx, by, aLineWidth, bLineWidth, vertices)
Description:
Computes the four vertices of the quad that represents a line segment and appends them to the provided vertices list. The line can vary in width between its start point (a) and end point (b), producing a tapered shape. Eight values are appended (four x/y pairs) in the order TL, BL, BR, TR, relative to the line's direction.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| drawingContext | Phaser.Renderer.WebGL.DrawingContext | No | The context currently in use. |
| currentMatrix | Phaser.GameObjects.Components.TransformMatrix | No | A transform matrix to apply to the vertices. If not defined, the vertices are not transformed. |
| ax | number | No | The x coordinate of the start of the line. |
| ay | number | No | The y coordinate of the start of the line. |
| bx | number | No | The x coordinate of the end of the line. |
| by | number | No | The y coordinate of the end of the line. |
| aLineWidth | number | No | The width of the line at the start. |
| bLineWidth | number | No | The width of the line at the end. |
| vertices | Array.<number> | No | The list to which the vertices are assigned. |
Overrides: Phaser.Renderer.WebGL.RenderNodes.RenderNode#run
Source: src/renderer/webgl/renderNodes/DrawLine.js#L40
Since: 4.0.0
Inherited Members
From Phaser.Renderer.WebGL.RenderNodes.RenderNode: