Watch! As color groups consume one another like rabid dogs.
Youtube
Vimeo
If you want to render it yourself at a speed of 1000% slower, copy and paste this code into Processing.
public int snakes = 5000; public int[] numholdx = new int[snakes]; public int[] numholdy = new int[snakes]; public color[] colorhold = new color[snakes]; void setup() { int q = 0; for (int k = 0 ; k < snakes; k++) { q+=1; if (k < 999) { numholdx[k] = 100; numholdy[k] = 100; } else if ( k >= 999 && k < 1999 ) { numholdx[k] = 1160; numholdy[k] = 600; } else if ( k >= 1999 && k < 2999 ) { numholdx[k] = 1160; numholdy[k] = 100; } else if ( k >= 2999 && k < 3999 ) { numholdx[k] = 100; numholdy[k] = 600; } else if ( k >= 3999 && k < 4999 ) { numholdx[k] = 640; numholdy[k] = 360; } } int swap = 0; for (int k = 0 ; k < snakes; k++) { if (k < 999) { switch(swap) { case 0: colorhold[k] = #800026; break; case 1: colorhold[k] = #bd0026; break; case 2: colorhold[k] = #e31a1c; break; case 3: colorhold[k] = #fc4e2a; break; case 4: colorhold[k] = #ec7014; break; case 5: colorhold[k] = #cc4c02; break; case 6: colorhold[k] = #993404; break; case 7: colorhold[k] = #662506; break; } swap +=1; if ( swap == 8 ) swap = 0; } else if ( k >= 999 && k < 1999 ) { switch(swap) { case 0: colorhold[k] = #fff7fb; break; case 1: colorhold[k] = #ece7f2; break; case 2: colorhold[k] = #d0d1e6; break; case 3: colorhold[k] = #a6bddb; break; case 4: colorhold[k] = #74a9cf; break; case 5: colorhold[k] = #3690c0; break; case 6: colorhold[k] = #0570b0; break; case 7: colorhold[k] = #034e7b; break; } swap +=1; if ( swap == 8 ) swap = 0; } else if ( k >= 1999 && k < 2999 ) { switch(swap) { case 0: colorhold[k] = #f7fcfd; break; case 1: colorhold[k] = #e5f5f9; break; case 2: colorhold[k] = #ccece6; break; case 3: colorhold[k] = #99d8c9; break; case 4: colorhold[k] = #66c2a4; break; case 5: colorhold[k] = #41ae76; break; case 6: colorhold[k] = #238b45; break; case 7: colorhold[k] = #005824; break; } swap +=1; if ( swap == 8 ) swap = 0; } else if ( k >= 2999 && k < 3999 ) { switch(swap) { case 0: colorhold[k] = #f7f4f9; break; case 1: colorhold[k] = #e7e1ef; break; case 2: colorhold[k] =#d4b9da; break; case 3: colorhold[k] = #c994c7; break; case 4: colorhold[k] = #df65b0; break; case 5: colorhold[k] =#e7298a; break; case 6: colorhold[k] = #ce1256; break; case 7: colorhold[k] = #91003f; break; } swap +=1; if ( swap == 8 ) swap = 0; } else if ( k >= 3999 && k < 4999 ) { switch(swap) { case 0: colorhold[k] = #000000; break; case 1: colorhold[k] = #737373; break; case 2: colorhold[k] =#525252; break; case 3: colorhold[k] = #252525; break; case 4: colorhold[k] = #969696; break; case 5: colorhold[k] =#000000; break; case 6: colorhold[k] = #525252; break; case 7: colorhold[k] = #000000; break; } swap +=1; if ( swap == 8 ) swap = 0; } } size(1280, 720); background(#ffffff); } void draw() { stroke(000); fill(000); rect(0, 0, 20, 720); rect(1260, 0, 20, 720); rect(0, 0, 1280, 20); rect(0, 700, 1280, 20); for ( int line = 0; line < snakes; line ++) { fill(colorhold[line]); stroke(colorhold[line]); int r = int(random(0,4)); //random direction. int len_max = int(random(0,5)); //direction. int keep_dir = r; //box size. int size = 4; if ( keep_dir == 1 && get(numholdx[line], numholdy[line]- size) == -16777216) keep_dir = 3; else if ( keep_dir == 3 && get(numholdx[line], numholdy[line] + size + size) == -16777216) keep_dir = 1; else if ( keep_dir == 0 && get(numholdx[line] + size + size, numholdy[line]) == -16777216) keep_dir = 2; else if ( keep_dir == 2 && get(numholdx[line] - size, numholdy[line]) == -16777216) keep_dir = 0; if ( keep_dir == 0) { rect( numholdx[line] + size, numholdy[line], size, size, 2); numholdx[line] += size; } else if ( keep_dir == 3) { rect( numholdx[line], numholdy[line] + size,size, size, 2); numholdy[line] += size; } else if ( keep_dir == 2) { rect( numholdx[line] - size, numholdy[line], size, size, 2); numholdx[line] -= size; } else if ( keep_dir == 1) { rect( numholdx[line], numholdy[line]- size,size, size, 2); numholdy[line] -= size; } } } |