mgs
mgs

Reputation: 2689

Drawing order in HTML canvas

I'm trying to draw some circles with numbers on top of them, in a for loop. But for some reason numbers end up behind circles: https://jsfiddle.net/6c3yfLou/1/

Upvotes: 0

Views: 758

Answers (1)

user1693593
user1693593

Reputation:

Remember beginPath() - this will clear the current path. Otherwise all previous added arcs will be filled every time fill() is called.

c.beginPath();
c.arc(x, y, 20, 0, Math.PI*2, true);
...

Updated fiddle

Upvotes: 1

Related Questions