import processing.opengl.*; import toxi.geom.*; import toxi.math.*; int RESX=15; int RESY=35; int RESZ=15; float noiseScaleX=3f/RESX; float noiseScaleY=3f/RESY; float noiseScaleZ=3f/RESZ; int depth; float tres; Grid grid; Grid newGrid; Grid oldGrid; int state; float angleX,angleY; int waitCounter; int morphCounter; void setup(){ size(800,800,OPENGL); depth=width; background(255); hint(ENABLE_OPENGL_4X_SMOOTH); frameRate(20); angleX=angleY=0f; tres=0f; grid = populateGrid(); oldGrid = grid.copy(); newGrid = populateGrid(); state=0; } void draw(){ background(120); angleX=0.8f*angleX+0.2f*(mouseY-200)*HALF_PI/200; angleY=0.8f*angleY+0.2f*(mouseX-200)*HALF_PI/200; lights(); translate(width/2f,height/2.2f,-.8f*depth); rotateY(angleY); //rotateX(angleX); noStroke(); fill(255); grid.draw(width/RESX,1.4f*height/RESY,depth/RESZ,tres+0.1f); noFill(); stroke(255,200,200,30); grid.draw(width/RESX,1.4f*height/RESY,depth/RESZ,0.1f); // shrinking if(state==0){ tres+=0.005f; if (tres>=1.0f){ state=1; tres=1.0f; waitCounter=0; } } // wait if(state==1){ waitCounter++; if(waitCounter==20){ state=2; morphCounter=0; oldGrid=grid.copy(); newGrid=populateGrid(); } } // growing + morphing if(state==2){ morphCounter++; for(int i=0;i