Skip to main content
Version: Phaser v4.0.0

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

nametypeoptionaldescription
managerPhaser.Renderer.WebGL.RenderNodes.RenderNodeManagerNoThe manager that owns this RenderNode.

Scope: static

Extends

Phaser.Renderer.WebGL.RenderNodes.RenderNode

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:

nametypeoptionaldescription
drawingContextPhaser.Renderer.WebGL.DrawingContextNoThe context currently in use.
submitterNodePhaser.Renderer.WebGL.RenderNodes.BatchHandlerTriFlatNoThe Submitter node to use.
pathArray.<Phaser.Types.GameObjects.Graphics.WidePoint>NoThe points that define the line segments.
lineWidthnumberNoThe width of the stroke.
openbooleanNoIf 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.
currentMatrixPhaser.GameObjects.Components.TransformMatrixNoThe current transform matrix.
tintTLnumberNoThe top-left tint color.
tintTRnumberNoThe top-right tint color.
tintBLnumberNoThe bottom-left tint color.
tintBRnumberNoThe bottom-right tint color.
detailnumberNoThe 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.
lightingbooleanNoWhether 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