fractalkitty looking for math? fractalkitty.com

Genuary 2025

Black on black.

#random#trig#3d#interactive#animation#genuary

let w, n;
let c = [0, 5, 15];
let a = [];
function setup() {
  cnv = createCanvas((w = 500), w, WEBGL);
  noStroke();
  a = [];
  describe("a pebble texture that moves, but is drawn with shades of black");
  for (let i = 0; i < 5000; i++) {
    a[i] = {
      x: random(-w / 2, w / 2),
      y: random(-w / 2, w / 2),
      z: random(-w / 2, w / 2),
      r: random(-w / 20, w / 20),
      r1: random(-10, 10),
      m: random(-1, 1)
    };
  }
}
function draw() {
  strokeWeight(5);
  t = frameCount / 100;
  n = int(random(40, 60));
  background(c[0], c[1], c[2]);
  pointLight(c[0] + 15, c[1] + 15, c[2] + 15, -1600, 1600, 1600);
  pointLight(c[0] + 25, c[1] + 25, c[2] + 25, 1600, 1600, -1600);
  orbitControl();
  for (let i = 0; i < a.length; i++) {
    r1 = random(-10, 10);
    specularMaterial(c[0] + a[i].r1, c[1] + a[i].r1, c[2] + a[i].r1, 100);
    push();
    let x = a[i].x + a[i].r * sin(t * a[i].m + a[i].r);
    let y = a[i].y + a[i].r * cos(t * a[i].m + a[i].r);
    let z = a[i].z + a[i].r * sin(t * a[i].m + a[i].r) * cos(t * a[i].m);
    translate(x, y, z);

    sphere(4 + 10 * abs(sin(x / 50 + t - y / 60) * cos(x / 60 + t - y / 20)));

    pop();
  }
}