Skip to content

Line Cap

The lineCap property represents the style of the line end cap.

Possible line cap optionsDescription
Graphics.LineCap.BUTTDefault. Add a straight edge to each end of the line.
Graphics.LineCap.ROUNDAdd a circular cap to each end of the line.
Graphics.LineCap.SQUAREAdd a square line cap to each end of the line.

Example

ts
const ctx = node.getComponent(Graphics);
ctx.lineCap = Graphics.LineCap.ROUND;
ctx.lineWidth = 10;
ctx.moveTo(100, 100);
ctx.lineTo(300, 100);
ctx.stroke();

lineCap.png


Return to the Graphics Component Reference documentation.