Last active
May 26, 2021 05:24
-
-
Save webbisswiftapps/ba95677f94e83f56fea5db4e9d1cc712 to your computer and use it in GitHub Desktop.
Processing sketch to generate a pattern using the 10print algorithm.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int canvasWidth = 1920; | |
int canvasHeight = 1080; | |
int originX = 0; | |
int originY = 0; | |
int lineUnit = 25; | |
int startX = originX; | |
int startY = originY; | |
void setup(){ | |
size(1920, 1080); | |
background(10, 20, 30); | |
} | |
void draw(){ | |
if(startX > canvasWidth){ | |
startX = 0; | |
startY = startY +lineUnit; | |
} | |
if(startY > canvasHeight){ | |
save("patterns_final.png"); //after the whole canvas is rendered, save it as an image and exit. | |
exit(); | |
} | |
stroke(255, 104, random(105)); | |
stroke(random(255), random(255), random(255)); | |
fill(random(255), random(255), random(255)); | |
if(random(1) < 0.5){ | |
line(startX,startY, startX+lineUnit,startY+lineUnit); | |
circle(startX, startY, lineUnit / 2); | |
}else{ | |
line(startX,startY+lineUnit, startX+lineUnit,startY); | |
circle(startX, startY + lineUnit, lineUnit / 4); | |
} | |
startX = startX + lineUnit; | |
//saveFrame("frames/patterns_####.png"); //save each frame | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment