We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am new to processing and trying to create an array to contain a set of pre-defined colors. When I run, I get "Syntax error on token "int", invalid ClassType " for the line that contains "colors[c] = new color(hue);"
Is there a small change that I have to make in creating the array or am I going about this all wrong? I would like to use the array in creating 16 ellipses using a for loop, with each ellipse as a different color.
color c1 = #FF0000;
color c2 = #FFC000;
color c3 = #E0FF00;
color c4 = #7EFF00;
color c5 = #21FF00;
color c6 = #00FF41;
color c7 = #00FF9F;
color c8 = #00FDFF;
color c9 = #009FFF;
color c10 = #003DFF;
color c11 = #2100FF;
color c12 = #8300FF;
color c13 = #E500FF;
color c14 = #0052FF;
color c15 = #FF007C;
color c16 = #1000FF;
color c17 = #FFFFFF;
color[] colors;
void setup() {
size(800, 950);
background(c17);
colors = new color[colors.length];
for (int c = 0; c < colors.length; c ++) {
color hue = color(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17);
colors[c] = new color(hue);
}
}
void draw() {
//still working out how to implement the color array into creating the ellipses, I'm very new to processing.
for (float i = 150; i < 701; i = i+166) {
for (float j = 150; j < 701; j = j+166) {
ellipse(i, j, 100, 100);
}
}
}
Answers
here...
Thanks!
you're welcome!