fractalkitty looking for math? fractalkitty.com

Mathober 2025

Number Field

#random#trig#grid#interactive#animation#math#geometry#mathober

drawGrid


let t = 0;
let n = 25;

function setup() {
  createCanvas(500, 500);
  background(255);
  describe("Polygons nested starting with triangles, and then squares, petntagons, etc. all drawn on top of each other so that they slowly start to look like concentric circles. Drawn on staticky radial graph paper.");
  rectMode(CENTER);
  strokeWeight(0.5);
  strokeCap(SQUARE);
  rs = [];
}

function draw() {
  background(245, 250, 255, 30);
  translate(width / 2, height / 2);
  stroke(100, 110, 120, 10);
  drawGrid();
  t += 1;
  noFill();
  noStroke();
  strokeWeight(1.5);
  stroke(50, 60, 70, 10);
  for (let k = 0; k < 10; k++) {
    r = (width / 25) * 12 - (width / 25) * k;
    for (let i = 3; i < floor(80 * abs(sin(t / 1000)) + 3); i++) {
      beginShape();
      for (j = 0; j <= i; j++) {
        x = r * cos(((2 * PI) / i) * j);
        y = r * sin(((2 * PI) / i) * j);
        vertex(x, y);
        push();
        fill(40, 50, 60);
        circle(x, y, 1);
        pop();
      }
      endShape();
    }
  }

  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();
}