fractalkitty looking for math? fractalkitty.com

Mathober 2025

Odious

#random#trig#grid#interactive#animation#math#number-theory#spiral#mathober

domainisOdiousdrawGrid


let t = 0;
let n = 25;
let rs;
let domain;

function setup() {
  domain = [-2 * PI, 2 * PI];
  createCanvas(500, 500);
  background(255);
  describe(
    "A spiral turning with alternating dark and light (8 arms) with gleams of light that almost makes it look like it is under water. The opacity ebs and flows. The spiral is formed by making dots larger and smaller raidially over time. a spiral broken up in to 10000 dots and only odious numbers from 0 to 10000 are drawn leaving the breaks that look like gleams."
  );
  rectMode(CENTER);
  strokeWeight(0.5);
  strokeCap(SQUARE);
  rs = [];
  t = random(-10, 10);
}

function isOdious(NUM) {
  binary = NUM.toString(2);
  return (binary.split("1").length - 1) % 2 === 1;
}

function draw() {
  background(245, 250, 255, 20);
  translate(width / 2, height / 2);
  stroke(100, 110, 120, 10);
  drawGrid();
  t += 0.02;
  noFill();
  noStroke();
  r = width / 50;
  fill(50, 60, 70, 20 + 5 * sin(t / 3));
  for (let i = 0; i < 10000; i += 0.5) {
    r += 0.02;
    if (isOdious(i)) {
      circle(
        r * cos(((2 * PI) / 50) * i),
        r * sin(((2 * PI) / 50) * i),
        r / 30 + (r / 10) * sin(t + i)
      );
    }
  }

  strokeWeight(1);
  noFill();
  stroke(100, 110, 120, 30);
  rect(0, 0, width / 1.02, width / 1.02);
  rect(0, 0, width / 1.04, width / 1.04);
}

function drawGrid() {
  for (let i = 0; i < n; i++) {
    rotate((2 * PI) / n);
    line(-width / 1.5, 0, width / 1.5, 0);
    circle(0, 0, (width / n) * 2 * i);
  }
  noStroke();
  for (let i = 0; i < 500; i++) {
    x = random(-width / 2, width / 2);
    y = random(-width / 2, width / 2);
    fill(245, 250, 255, 150);
    circle(x, y, 2);
  }
}

function mousePressed() {
  setup();
  draw();
}