Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17091

Cocos Creator 3 drawing with graphics does not display

$
0
0

I am using Cocos Creator 3.

I add cc.Graphics component to a node. This node is in UI_2D layer.

got reference to the component by

this.node.getComponent(Graphics);

Then I try following code to draw a rectangle.

     this.graphics.lineWidth = 2;


    this.graphics.moveTo(arrPoints[0].x, arrPoints[0].y);
    this.graphics.lineTo(arrPoints[1].x, arrPoints[1].y);
    this.graphics.lineTo(arrPoints[2].x, arrPoints[2].y);
    this.graphics.lineTo(arrPoints[3].x, arrPoints[3].y);
    this.graphics.close();

    this.graphics.strokeColor = Color.WHITE;
    this.graphics.stroke();

But it does not draw anything. What am I doing wrong here ?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 17091


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>