Created
December 6, 2019 16:59
-
-
Save manoloide/017767c73f9d46eefec9569ebc7d81af to your computer and use it in GitHub Desktop.
This file contains 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 seed = int(random(999999)); | |
boolean export = false; | |
void setup() { | |
size(960, 960, P2D); | |
smooth(8); | |
pixelDensity(2); | |
generate(); | |
if (export) { | |
saveImage(); | |
exit(); | |
} | |
} | |
void draw() { | |
} | |
void keyPressed() { | |
if (key == 's') saveImage(); | |
else { | |
seed = int(random(999999)); | |
generate(); | |
} | |
} | |
void generate() { | |
randomSeed(seed); | |
noiseSeed(seed); | |
background(0); | |
} | |
void saveImage() { | |
String timestamp = year() + nf(month(), 2) + nf(day(), 2) + "-" + nf(hour(), 2) + nf(minute(), 2) + nf(second(), 2); | |
saveFrame(timestamp+"-"+seed+".png"); | |
} | |
int colors[] = {#687FA1, #AFE0CD, #FDECB4, #F63A49, #FE8141}; | |
int rcol() { | |
return colors[int(random(colors.length))]; | |
} | |
int getColor() { | |
return getColor(random(colors.length)); | |
} | |
int getColor(float v) { | |
v = abs(v); | |
v = v%(colors.length); | |
int c1 = colors[int(v%colors.length)]; | |
int c2 = colors[int((v+1)%colors.length)]; | |
return lerpColor(c1, c2, v%1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment