Phaser API Documentation

Only webGL lineGradientStyle(lineWidth, topLeft, topRight, bottomLeft, bottomRight, [alpha])


Sets a gradient line style. This is a WebGL only feature.

The gradient color values represent the 4 corners of an untransformed rectangle. The gradient is used to color all stroked shapes and paths drawn after calling this method. If you wish to turn a gradient off, call lineStyle and provide a new single line color.

This feature is best used only on single lines. All other shapes will give strange results.

Note that for objects such as arcs or ellipses, or anything which is made out of triangles, each triangle used will be filled with a gradient on its own. There is no ability to gradient stroke a shape or path as a single entity at this time.


name type arguments Default description
lineWidth number

The stroke width.

topLeft number

The tint being applied to the top-left of the Game Object.

topRight number

The tint being applied to the top-right of the Game Object.

bottomLeft number

The tint being applied to the bottom-left of the Game Object.

bottomRight number

The tint being applied to the bottom-right of the Game Object.

alpha number <optional> 1

The fill alpha.


This Game Object.

Since: 3.12.0