Cocos Creator
Close
The close()
method is used to create a path from a current point to the beginning point.
Example
ts
const ctx = node.getComponent(Graphics);
ctx.moveTo(20,20);
ctx.lineTo(20,100);
ctx.lineTo(70,100);
ctx.close();
ctx.stroke();
![](/creator/3.1/manual/assets/close.DAeH5J08.png)
Return to the Graphics Component Reference documentation.