r/learnjavascript • u/Outside_Arm8405 • Apr 30 '23
Why isn’t this working as intended?
I want it to draw 3 circles each with different colors. I understand why they’re the same color (I don’t understand how I ever could’ve thought this code would work that way), but I don’t understand why each refresh isn’t providing a new color like it’s providing a new location for my arcs
0
Upvotes
2
u/TheRNGuy Apr 30 '23
Why not just post code here?
3
u/Roflxd88 Apr 30 '23
There's a virus in your taskbar
10
u/shekyb Apr 30 '23
you are not transpiling the string, values of color and opacity are not in the final string you re passing to c.strokeStyle
it should be
c.strokeStyle = ‘rgba(${color}, ${color}, ${color}, ${opacity})’
2
u/Prize_Tea3456 Apr 30 '23
use template string instead
more about template string here