Shifting a for loop pattern
in
Programming Questions
•
2 years ago
Having a little trouble shifting a for loop pattern. Guessing this isn't impossible..
This is my code:
void setup() {
size(500,500);
smooth();
}
void draw() {
for (int s = 0; s < 640; s += 90) {
for (int t = 0; t < 4800; t += 30) {
fill(#0770FF);
rect(s,t,10,10);
rect(s+10,t+10,20,20);
fill(#777FFF);
rect(s+30,t,10,10);
rect(s+40,t+10,20,20);
fill(#07700F);
rect(s+60,t,10,10);
rect(s+70,t+10,20,20);
}
}
What I'm trying to do is shift the pattern so the colors line up in diagonals. Sort of like when you add a translate(s/3,0); but for the whole screen.
thanks
1