Last active
January 11, 2017 14:50
-
-
Save bgola/eb9a6c73faa28495301d1a5ea8dabffe to your computer and use it in GitHub Desktop.
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
float f; | |
float step_i = 0.05; | |
float step_j = 0.05; | |
boolean savegif; | |
int nd = 6; | |
void setup() { | |
//size(851, 315); | |
size(1200, 800); | |
colorMode(HSB); | |
} | |
void draw() { | |
noiseDetail(nd); | |
translate(width/2, height/2); | |
loadPixels(); | |
for (int i=-height/2; i<height/2; i++){ | |
for (int j=-width/2; j<width/2; j++){ | |
pixels[(i+height/2)*width+(j+width/2)] = color(map(noise((step_i*i), (step_j*j), f), 0, 1, 0, 255)); //,255,255); | |
} | |
} | |
updatePixels(); | |
if (savegif) { | |
saveFrame("frame_" + frameCount + ".jpg"); | |
} | |
f+=0.02; | |
} | |
void keyPressed() { | |
if (key == '=') { | |
step_i += 0.001; | |
step_j += 0.001; | |
} else if (key == '-') { | |
step_i -= 0.001; | |
step_j -= 0.001; | |
} else if (key == 'i') { | |
step_i += 0.001; | |
} else if (key == 'k') { | |
step_i -= 0.001; | |
} else if (key == 'j') { | |
step_j += 0.001; | |
} else if (key == 'm') { | |
step_j -= 0.001; | |
} else if(key == ' ') { | |
saveFrame("pattern.jpg"); | |
} else if(key == 'g') { | |
if (!savegif) { | |
savegif = true; | |
} else { | |
savegif = false; | |
} | |
} else if(key == 'x') { | |
nd++; | |
} else if(key == 'z') { | |
nd--; | |
} else { | |
noiseSeed((long)random(10000)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment