Hello, I need some help getting the colors to work. I wanted the strokeStyle=‘blue’ and the fillStyle=‘green’;
I tried changing them rgba() color system, but I get the error: “Uncaught ReferenceError: rgba is not defined”. I commented the line: ctx.fillStyle = rgba(0, 255, 0, 0.5);, so it can work, but no colors.
Any help would be appreciated,
Upps forgot the link to code pen:
Hey there, I hope you’re doing well and enjoying your learning journey!
I noticed a few things that I’d like to help you out with, but first, to answer your question, the problem is that you’re giving ctx.fillStyle
a non-string value where it expects a string. It should be:
ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
Or however else you prefer to format your strings: Setting styles
I also recommend that you take a look at this tutorial for Codepen by none other than Chris Coyier, the founder of Codepen, as I noticed a few issues with your pen: https://www.youtube.com/watch?v=vb9uYBtqmeM
Here are some of the issues I noticed:
Likewise, you have the <style> tags in the CSS file, which are not needed either.
I hope this helps, have a nice time learning!
Hey Ordehi,
Thanks for helping and for the codepen tips.