Skip to content

Instantly share code, notes, and snippets.

@asciimo
Created February 5, 2018 23:36
Show Gist options
  • Save asciimo/df6df512770e931d50d9136d5c188ab4 to your computer and use it in GitHub Desktop.
Save asciimo/df6df512770e931d50d9136d5c188ab4 to your computer and use it in GitHub Desktop.
Processing sketch for generating grayscale, interlocking circles suitable for a desktop background.
// Pressing Control-R will render this sketch.
int x = 50;
int y = 50;
void setup() { // this is run once.
// set the background color
background(255);
// canvas size (Integers only, please.)
size(2048, 1536);
// smooth edges
smooth();
// limit the number of frames per second
frameRate(30);
// set the width of the line.
strokeWeight(2);
}
void draw() { // this is run repeatedly.
// set the color
stroke(0, 0, 0, random(100));
fill(random(255), random(100));
// draw a circle
ellipse(x, y, 100, 100);
// move over a pixel
if (x < (width - 50)) {
x += 50;
} else {
x = 0;
y += 50;
}
if (y >= (height - 50)) {
y = 50;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment