String rand_seed = "SEED"; String d = rand_seed.replaceAll("[^0-9]", "").replaceAll("^0+(?!$)", ""); int ri = Integer.parseInt(d.substring( d.length() -9));  float P = (1 + sqrt(5)) / 2; float[][] sv = { {-1,P, 0}, { 1,P, 0}, {-1, -P, 0}, { 1, -P, 0}, {0, -1, P}, {0,1, P}, {0, -1, -P}, {0,1, -P}, { P, 0, -1}, { P, 0,1}, {-P, 0, -1}, {-P, 0,1} }; int[][] sf = {  {0, 11, 5},  {0, 5, 1},  {0, 1, 7},  {0, 7, 10},  {0, 10, 11},  {1, 5, 9},  {5, 11, 4},  {11, 10, 2},  {10, 7, 6},  {7, 1, 8},  {3, 9, 4},  {3, 4, 2},  {3, 2, 6},  {3, 6, 8},  {3, 8, 9},  {4, 9, 5},  {2, 4, 11},  {6, 2, 10},  {8, 6, 7},  {9, 8, 1} }; ArrayList<float[]> vs = new ArrayList<float[]>(); ArrayList<int[]> fs = new ArrayList<int[]>();  float fv = 0.05; float nc = 0.1; float rl = 0.01; int ms = 130; int fr = 400; int ft = fr; int fp = 120; int fc = 200;  public float[] nv(float[] v) { float l2 = sqrt(sq(v[0])+sq(v[1])+sq(v[2])); float[] r = {v[0]*rad/l2,v[1]*rad/l2,v[2]*rad/l2}; return r; }  HashMap<String, Integer> mp = new HashMap<String, Integer>(); public int mt(int p1, int p2) { int si = min(p1, p2); int gi = max(p1, p2); String key = Integer.toString(si)+"-"+Integer.toString(gi); if (mp.containsKey(key)) { return mp.get(key);} float[] v1 = vs.get(p1); float[] v2 = vs.get(p2); float[] md = { (v1[0]+v2[0])/2, (v1[1]+v2[1])/2, (v1[2]+v2[2])/2 }; vs.add( nv(md) ); int ix = vs.size() - 1; mp.put(key, ix); return ix; }  public ArrayList<int[]> de(ArrayList<int[]> fs) { ArrayList<int[]> fsd = new ArrayList<int[]>(); for (int i = 0; i < fs.size(); i++) { int[] tri = fs.get(i); int v1 = mt(tri[0], tri[1]); int v2 = mt(tri[1], tri[2]); int v3 = mt(tri[2], tri[0]); fsd.add(new int[] {tri[0], v1, v3}); fsd.add(new int[]{tri[1], v2, v1}); fsd.add(new int[]{tri[2], v3, v2}); fsd.add(new int[]{v1, v2, v3}); } return fsd; }  int[] cs = new int[12]; ArrayList<float[]> vd = new ArrayList<float[]>(); int lix = 0; int np; ArrayList<float[]> og_vs = new ArrayList<float[]>(); float rad; float rix; float ps; float[] ot; float sg; float lln; void setup(){ randomSeed(ri); noiseSeed(ri); size(1000, 1000, P3D); smooth(); frameRate(30); int sb = Math.round( random(3) )+3; lln = rad; rix = random(1000, 10000); ps = 10;  ot = new float[] {random(-rl, rl), random(-rl, rl) }; if (random(1)<0.2){ sg = random(0.42, 0.50); rad = random(20)+ 75; } else { sg = random(0.54, 0.62); rad = random(20)+ 55; } for (int i = 0; i < sf.length; i++) { fs.add(sf[i]); }  for (int i = 0; i < 12; i++) { cs[i] = Math.round(random(255)); } for (int i = 0; i <sv.length; i++) { vs.add( nv(sv[i]) ); }  for (int i = 0; i < sb; i++) { fs = de(fs); } for (float[] v : vs){ og_vs.add(v); } np = Math.round(fv*vs.size())+1; background(cs[0],cs[1],cs[2]); }  void draw() {  translate(width/2,height/2,600); background(cs[0],cs[1],cs[2]); lights();  rotateY(ot[0]*frameCount); rotateZ(ot[1]*frameCount); directionalLight(cs[3], cs[4], cs[5], -1, 0, 0); fill(cs[6],cs[7],cs[8]); stroke(cs[9],cs[10],cs[11]); beginShape(TRIANGLES); for (int[] face_points : fs){ for (int p : face_points) { vertex(vs.get(p)[0],vs.get(p)[1],vs.get(p)[2]); } } endShape();  float sd = 1 -(0.000003*sq(lln)); float pw = sg * sd;  if (frameCount < ft) { for (int i = 0; i < np; i++) { int r_ind = Math.round( noise(rix*random(0.1)*i*(ft-frameCount) )*(vs.size()-1) );  float ln = sqrt(sq(vs.get(r_ind)[0])+sq(vs.get(r_ind)[1])+sq(vs.get(r_ind)[2])); if (ln>lln) { lln = ln; lix = r_ind; } float nois = 1-( nc*(1-pw) ) + (nc*noise(og_vs.get(r_ind)[0]+random(ps), og_vs.get(r_ind)[1]+random(ps), og_vs.get(r_ind)[2]+random(ps) )); if (ln>ms && nois>1.0){ continue; } vs.set(r_ind, new float[] {vs.get(r_ind)[0]*nois, vs.get(r_ind)[1]*nois, vs.get(r_ind)[2]*nois} ); } } else if (frameCount>=ft && frameCount < (ft+fp)) { } else if ( frameCount >= (ft+fp) && frameCount <= (ft+fp+fc) ) { if (frameCount == ft+fp){ for (int i = 0; i < vs.size(); i++) { float[] v1 = vs.get(i); float[] v2 = og_vs.get(i); vd.add( new float[] {(v1[0]-v2[0])/fc, (v1[1]-v2[1])/fc, (v1[2]-v2[2])/fc} ); } } else { for (int i = 0; i < vs.size(); i++) { float[] v1 = vs.get(i); float[] v2 = vd.get(i); vs.set(i, new float[] { v1[0]-v2[0],v1[1]-v2[1],v1[2]-v2[2] } ); } } } else{ ft = fr+frameCount; vd = new ArrayList<float[]>(); lln = rad; lix = 0; } }