Skip to content

Instantly share code, notes, and snippets.

@bgola bgola/noisemandalas.pde
Last active Jan 11, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.