Hello,
I’ve extracted my problem from a larger sketch, but the main problem is here.
When I run this, the colours and letters appear alright, but I get this error:
Uncaught Error: [object Arguments]is not a valid colour representation. (sketch: line 17)
If I remove the fill() command, then I get this error:
text() was expecting String|Object|Array|Number|Boolean for parameter #0 (zero-based index), received an empty variable instead. If not intentional, this is often a problem with scope:
I’m relatively new to coding, but can’t figure out why I can’t just pull these values from the arrays. I’m sure it’s something simple but I don’t know what I’m missing.
In the bigger sketch where I am using this, everything past this point in the draw function won’t work, so I’ve got to try and figure it out. Any help would be appreciated!
var colours = ['#CE2144', '#EC952F', '#FFFF00', '#90d40c', '#009287', '#554A8A', '#BC3984', '#CE2144'];
var letters = ["C", 'D', 'E', 'F', 'G', 'A', 'B', "C'"]
var start = 20
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
textSize(50)
for (i = 0; i <= letters.length; i++) {
fill(colours[i])
text(letters[i], start, height/2);
start = start+40;
}
}