rect

    1. var ctx = node.getComponent(cc.Graphics);
    2. // 红色矩形
    3. ctx.lineWidth = 6;
    4. ctx.strokeColor = cc.Color.RED;
    5. ctx.stroke();
    6. // 绿色矩形
    7. ctx.lineWidth=4;
    8. ctx.strokeColor = cc.Color.GREEN;
    9. // 蓝色矩形
    10. ctx.lineWidth = 10;
    11. ctx.strokeColor = cc.Color.BLUE;
    12. ctx.stroke();