Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Is it possible to create an indexed list (array) of RGB values for "fill()"?

$
0
0

I'm creating a (10 bar) bar graph inside a 'for' loop, and want to 'fill' each bar in a different colour from an indexed list (or array) of RGB colours. I'm sure it must be possible, but everything I've tried has failed. :(

Does anyone know how this could be done?

To help it make sense, this is the size statement: size(600,200);

Here's the 'for' loop:-

for(Index=0;Index<10;Index++) { InBuffer[Index]=MyPort.read(); fill(<*indexed RGB value*>); rect(Index*60,200,60,-InBuffer[Index]); }

(This is my first 'real' sketch.)

Thanks in advance, guys.


Viewing all articles
Browse latest Browse all 2896

Trending Articles