fractalkitty looking for math? fractalkitty.com

all

notation

#random#trig#animation#math#mathober

function setup() {
  createCanvas(500, 500);
  background(255);
  describe("A pulsing square on radial graph paper that has a staticky feel.");
  rectMode(CENTER);
  strokeWeight(0.5);
}

function draw() {
  background(245, 250, 255, 20);
  translate(width / 2, height / 2);
  n = 25;
  d = width / n;
  stroke(100, 110, 120, 10);
  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 < 1000; i++) {
    x = random(-width / 2, width / 2);
    y = random(-width / 2, width / 2);
    k = width / 4;
    condition1 = x < k && x > -k && y > -k && y < k;
    condition2 = y < k && y > -k && x > -k && x < k;
    if (condition1 || condition2) {
      fill(50, 60, 70, 150);
    } else {
      fill(245, 250, 255);
    }
    circle(x, y, random(1, 5) * cos(frameCount / 100));
  }
  noFill();
  stroke(100, 110, 120, 30);
  rect(0, 0, width / 1.02, width / 1.02);
  rect(0, 0, width / 1.04, width / 1.04);
}