StrokePath
A RenderNode which renders a stroke path as a series of connected line segments, optionally closing the path by connecting the last segment back to the first. It is used by the WebGL renderer to draw stroked shapes, such as those created by the Graphics Game Object. Each segment is rendered as a quad (two triangles), and adjacent segments are joined with an additional connecting quad when the stroke width exceeds two pixels. A level-of-detail mechanism allows intermediate points that are too close together in screen space to be skipped, reducing overdraw on dense paths.
Constructor
new StrokePath(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/StrokePath.js#L10
Since: 4.0.0
Inherited Members
From Phaser.Renderer.WebGL.RenderNodes.RenderNode:
Public Members
drawLineNode
drawLineNode: Phaser.Renderer.WebGL.RenderNodes.DrawLine
Description:
The RenderNode that generates a line segment.
Source: src/renderer/webgl/renderNodes/StrokePath.js#L35
Since: 4.0.0
Inherited Methods
From Phaser.Renderer.WebGL.RenderNodes.RenderNode:
Public Methods
run
<instance> run(drawingContext, submitterNode, path, lineWidth, open, currentMatrix, tintTL, tintTR, tintBL, tintBR, detail, lighting)
Description:
Render a stroke path consisting of several line segments.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| drawingContext | Phaser.Renderer.WebGL.DrawingContext | No | The context currently in use. |
| submitterNode | Phaser.Renderer.WebGL.RenderNodes.BatchHandlerTriFlat | No | The Submitter node to use. |
| path | Array.<Phaser.Types.GameObjects.Graphics.WidePoint> | No | The points that define the line segments. |
| lineWidth | number | No | The width of the stroke. |
| open | boolean | No | If true, the path is open and the last segment will not be connected back to the first. If false, the path is closed and a connecting quad is drawn between the last and first segments. |
| currentMatrix | Phaser.GameObjects.Components.TransformMatrix | No | The current transform matrix. |
| tintTL | number | No | The top-left tint color. |
| tintTR | number | No | The top-right tint color. |
| tintBL | number | No | The bottom-left tint color. |
| tintBR | number | No | The bottom-right tint color. |
| detail | number | No | The minimum distance, in screen-space pixels, between consecutive path points. Any intermediate point closer than this distance to the current point is skipped, reducing overdraw on dense paths. The final point of each segment is always preserved. Set to 0 to disable LOD and render every point. |
| lighting | boolean | No | Whether to apply lighting effects to the stroke. |
Overrides: Phaser.Renderer.WebGL.RenderNodes.RenderNode#run
Source: src/renderer/webgl/renderNodes/StrokePath.js#L45
Since: 4.0.0