i am trying to draw this 5 rectangles with an array but they have all the same opacity... But they should have different but i dont now why? Does someone can help me? Thank you in advance :) Sebastian
PGraphics[] pgArray = new PGraphics[5];
void setup() {
size(500, 500);
background(255);
for (int i = 0; i<pgArray.length; i++) {
pgArray[i] = createGraphics(500, 500);
}
}
void draw() {
for (int i = 0; i < pgArray.length; i++) {
pgArray[i].beginDraw();
pgArray[i].fill(0, (255/pgArray.length)*i+1);
pgArray[i].rect(20*i, 20*i, 50, 50);
pgArray[i].endDraw();
}
for(int i = 0; i < pgArray.length; i++){
image(pgArray[i],0,0);
}
}