Cocos Creator
Stroke
The stroke()
method draws the previous path generated by path related functions like lineTo
, rect
etc. The color used is strokeColor
and the line width is defined by lineWidth
.
Example
ts
const ctx = node.getComponent(Graphics);
ctx.moveTo(20, 100);
ctx.lineTo(20, 20);
ctx.lineTo(70, 20);
ctx.stroke();
Return to the Graphics Component Reference documentation.