Skip to content

Instantly share code, notes, and snippets.

@jonesfish
Last active October 23, 2015 02:14
Show Gist options
  • Select an option

  • Save jonesfish/40cf0ade6f05425e27f7 to your computer and use it in GitHub Desktop.

Select an option

Save jonesfish/40cf0ade6f05425e27f7 to your computer and use it in GitHub Desktop.
// v1
boolean white = true;
int spacing = 20;
size(400,300);
noStroke();
for (float x = 0; x<width; x+=spacing){
if (white){
fill(255);
}else{
fill(0);
}
rect(x, 0, spacing, height);
white = !white;
}
// v2
/*
int count = 0;
int spacing = 20;
size(400,300);
noStroke();
for (float x = 0; x<width; x+=spacing){
if (count % 2 == 0){
fill(255);
}else{
fill(0);
}
rect(x, 0, spacing, height);
count++;
}
*/
// v3
/*
int count = 0;
int spacing = 20;
size(400,300);
noStroke();
for (float x = 0; x<width; x+=spacing){
if (count % 3 == 0){
fill(255);
}else{
fill(0);
}
rect(x, 0, spacing, height);
count++;
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment