Why not paint a gradient of the elements in the canvas?

Hello. There is a function that draws the specified number of laps
function drawCircle(count){
for(var i=0; i<circles.length; 100 i++){ context.beginpath(); var circleoccupancy="2" * (circles[i].count circles[i].full 100), math.pi; grd.addcolorstop(0,"blue"); grd.addcolorstop(1,"red"); context.strokestyle="grd;" context.linewidth="35;" context.arc(centerx, centery, radius, 0, circleoccupancy, false); context.stroke(); } centerx+="canvas.width" (count 2) 2; })< code></circles.length;>
<br / > But for some reason the gradient only works on the first lap. The rest is just color. Tell me, please, what's the problem? Like, there are no errors.<br><img src="https://habrastorage.org/files/617/0e5/fae/6170e5faeee64bdea64aa3af1e2c36ce.png" alt="6170e5faeee64bdea64aa3af1e2c36ce.png">
June 27th 19 at 15:06
1 answer
June 27th 19 at 15:08
You somewhere have to be such line:
var grd=context.createLinearGradient( ... );
I think it is also necessary to change the coordinates.
That is it in a loop to shove. - alexanne commented on June 27th 19 at 15:11
unfortunately, did not help. - fae commented on June 27th 19 at 15:14
: Strange, but works for me: https://codepen.io/Madmadmax/pen/RVrwQm - alexanne commented on June 27th 19 at 15:17

Find more questions by tags CanvasJavaScript