Étape 13 : Crazy - Alien Sky et route
Cette formule génère un point de vue parsemée ciel et la route.
Remarque : Pour découvrir l’interactivité et obtenir les meilleures couleurs, certainement suivre http://www.openprocessing.org/sketch/138961. Bouger la souris haut et bas de modifications de la couleur ; déplacement horizontal de modifier l’angle de perspective.
Formule
WIDTH = 300; X_MIN = -1; X_MAX = 1; Y_MIN = 0.5; Y_MAX = -0.5; RATIO = 2; TIME_INCREMENT = 0.5; OUT_PAUSE = false; FRAMES = TWO_PI / TIME_INCREMENT; color hsb(x, y, t) { if(y==0) return color(0); // avoid zero-divide ay = abs(y); float direction = ((mouseX - WIDTH/2) / WIDTH) * TWO_PI; float val = cos(1/ay+t) * cos(x/ay - direction); // perspective spots raster val = 1 - pow(val,4); // increase contrast val *= y/Y_SPAN*2; // fade horizon to avoid moiree float band = sq(1/(x/ay - direction)); // V mask for central band float color_shift = mouseY/height; // H offset // pack all into HSV float h = 1+sin(val/2) + color_shift; float s = 3; float v = y<0 ? 3:band; return color(h*85, s*85, v*85); }