Skip to content

Instantly share code, notes, and snippets.

@stringandloop
Created May 8, 2020 19:14
Show Gist options
  • Save stringandloop/71001f55f944722648a2727671583103 to your computer and use it in GitHub Desktop.
Save stringandloop/71001f55f944722648a2727671583103 to your computer and use it in GitHub Desktop.
Rainbow sock pattern for DEV
float stripeHeight, stripeY, slope;
void setup() {
size(168, 400);
background(255);
noStroke();
noSmooth();
stripeHeight = height/20;
for (int i = 0; i < 40; i++) {
if (i % 6 == 0) {
fill(#f39090);
} else if (i % 6 == 1) {
fill(#fde090);
} else if (i % 6 == 2) {
fill(#f3ef9a);
} else if (i % 6 == 3) {
fill(#5ac1ae);
} else if (i % 6 == 4) {
fill(#8aafda);
} else if (i % 6 == 5) {
fill(#f6b4ce);
}
stripeY = i * stripeHeight;
slope = (stripeHeight * 6);
quad(0, stripeY - slope, width, stripeY, width,
stripeY + stripeHeight, 0, stripeY - slope + stripeHeight);
}
saveFrame();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment