fractalkitty looking for math? fractalkitty.com

Mathober 2025

Wedge

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

domaindrawGrid


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

function setup() {
  domain = [-2 * PI, 2 * PI];
  createCanvas(500, 500);
  background(255);
  describe(
    "wedges drawn around a circle that fall into each other as they rotate. Drawn on staticky radial graph paper in grey tones. "
  );
  rectMode(CENTER);
  strokeWeight(0.5);
  strokeCap(SQUARE);
  rs = [];
}

function draw() {
  background(245, 250, 255, 20);
  translate(width / 2, height / 2);
  stroke(100, 110, 120, 10);
  drawGrid();
  t += 0.002;
  r = width / 50;
  stroke(255);
  r1 = (width / 25) * 3;
  r2 = (width / 25) * 9;
  C = 3;
  a = (2 * PI) / 50;
  for (let i = 0; i < 50; i += 1 + 4 * abs(cos(t))) {
    fill(50, 60, 70, 120);
    beginShape();
    vertex(r1 * cos(i * a + t), r1 * sin(i * a + t));
    vertex(r2 * cos(i * a + t), r2 * sin(i * a + t));
    vertex(r2 * cos((i + C) * a + t), r2 * sin((i + C) * a + t));
    vertex(r1 * cos((i + C) * a + t), r1 * sin((i + C) * a + t));

    endShape(CLOSE);
    fill(100, 110, 120, 30);
    beginShape();
    vertex(r1 * cos(i * a + t), r1 * sin(i * a + t));
    vertex(r2 * cos((i - 1) * a + t), r2 * sin((i - 1) * a + t));
    vertex(r2 * cos(i * a + t), r2 * sin(i * a + t));
    endShape(CLOSE);
  }

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