Skip to content

Instantly share code, notes, and snippets.

@echophon
Last active August 29, 2015 14:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save echophon/7cd96caf963473120c6d to your computer and use it in GitHub Desktop.
Save echophon/7cd96caf963473120c6d to your computer and use it in GitHub Desktop.
PImage img;
void setup(){
size(500,500);
smooth();
}
void draw(){
background(#000000);
for (int ii=0; ii<25; ii++){
for (int kk=0; kk<25; kk++){
pushMatrix();
translate( width/25 * ii -12.5, height/25 * kk-12.5);
rect(0,0, random(30),random(30));
popMatrix();
// rotate(0.0001 * frameCount);
}
}
//fakey fake turing patterns - aka "reaction-diffusion"
if(frameCount % 1 == 0 && frameCount < 46)
{
for(int i = 0; i <60; i++){
//get the base image
img = get();
filter(BLUR, 2); //diffusion
filter(INVERT); //reaction pt1
//subtract the base image from the diffused version
blend(img, 0, 0, width, height, 0, 0, width, height, SUBTRACT); //reaction pt2
}
saveFrame("image-###.gif");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment