/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.WkvynZMJsG8/rev.184
*
* authors:
* Patrick DiGiovanni
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
float a = 0;
int detail;
float lvl;
void setup() {
size(600, 600, OPENGL);
colorMode(HSB);
PGraphics frameToSave = createGraphics(width, height, P2D);
}
void draw() {
background(0);
camera(81.5, 2.3, 225.3, // eyeX, eyeY, eyeZ
0.0, 0.0, 0.0, // centerX, centerY, centerZ
0.0, -0.4, -2.3); // upX, upY, upZ
// detail = int(map(sin(a*100), -1, 1, 8, 10));
directionalLight(noise(a)*78, 241, 215, -4, 179, -19);
ambientLight(193, 244, 221);
fill(253, 127);
// noFill();
// noStroke();
strokeWeight(0);
rotateY(-a/4);
rotateZ(a/10);
pushMatrix();
rotateX(a);
makeFractal(200, 30);
popMatrix();
a += 0.005;
}
void makeFractal(float size, float recursions) {
lvl = recursions;
lvl -= 1;
if (lvl > -1) {
pushMatrix();
rotateX(a);
translate(size, size, 0);
// sphereDetail(20);
scale(0.5, 0.5, 0.5);
sphere(size);
popMatrix();
rotateX(-a);
rotateY(a/4);
makeFractal(size *0.8, lvl);
}
}