Draw line using cc.Graphics component in Cocos Creator

How can I draw a smooth line using cc.Graphics component of Cocos Creator v1.3?

1 Like

You try.
this.drawing = this.node.getComponent(cc.Graphics);
this.drawing.lineWidth = 6;
this.drawing.moveTo(x, y);
this.drawing.lineTo(x2, y2);
this.drawing.strokeColor = cc.Color.RED;
this.drawing.stroke();
this.drawing.fill();

1 Like