Skip to content

Instantly share code, notes, and snippets.

@bgola
Last active January 11, 2017 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgola/eb9a6c73faa28495301d1a5ea8dabffe to your computer and use it in GitHub Desktop.
Save bgola/eb9a6c73faa28495301d1a5ea8dabffe to your computer and use it in GitHub Desktop.
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