Unexpected loop behavior

hey y’all.

I’m making a flavor wheel app. I made an array of points, then i looped over the points. I’m trying to make each line of points a certain color. When I assign the points a color, they don’t seem to be lining up like I expected. (example, point 100, 20 should be black but it is rendering as maroon). The very first point in the array is also not displaying as a color. why is this happening?

https://jsfiddle.net/2Lto8r4n/1/

Hi @edubz,

How about moving ctx.stroke(); after the if else conditions.
In that way, the strokeStyle will be set before ctx.stroke line is executed.

Hope it helps.

1 Like

ahhh yes indeed. thank you @manjupillai16

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.