fractalkitty looking for math? fractalkitty.com

borbs

BorbGenerator

#random#trig#interactive#tool#animals

Sometimes I just need a borb. They make good digital stickers, profile pics and more. I created the Borb Generator to make random borbs using pointillism in p5js. There are over 900,000 points in each Borb.

borb

function setup() {
  c = min(windowWidth, windowHeight);
  createCanvas(c, c);
  noLoop();
  angleMode(DEGREES);
  noStroke();
}

function draw() {
  background(255);
  translate(width / 2, height / 2);
  push();
  scale(0.9, 0.9);
  borb();
  pop();
}
function mousePressed() {
  translate(-width / 2, -height / 2);
  draw();
}

function borb() {
  fill(random(150, 200), random(200, 250), random(200, 255));
  for (let i = 0; i < 500000; i++) {
    circle(random(-width / 2, width / 2), random(-height / 2, height / 2), 2);
  }
  fill(random(50, 200), random(100, 250), random(100, 255));
  for (i = 0; i < 100000; i++) {
    r = random(-200, 200);
    theta = random(0, 360);
    circle(r * sin(theta), r * cos(theta), 2);
  }
  fill(random(0, 250), random(0, 250), random(0, 255));
  for (i = 0; i < 100000; i++) {
    r = random(-200, 200);
    theta = random(0, 360);
    x = r * sin(theta) + 300;
    y = r * cos(theta);
    if (x * x + y * y < 200 * 200) {
      circle(x, y, 2);
      circle(-x, y, 2);
    }
  }
  fill(random(0, 100), random(0, 100), random(0, 100));
  for (i = 0; i < 100000; i++) {
    r = random(-200, 200);
    theta = random(0, 360);
    x = r * sin(theta) + 300;
    y = r * cos(theta);
    if (x * x + y * y < 200 * 200) {
      circle(x / 7 - 19, y / 7 - 5, 2);
    }
  }
  push();
  translate(0, -20);
  fill(255);
  for (i = 0; i < 1000; i++) {
    r = random(-15, 15);
    theta = random(0, 360);
    x = r * sin(theta);
    y = r * cos(theta);
    circle(x - 40, y - 20, 2);
    circle(-x + 40, y - 20, 2);
  }
  fill(0);
  for (i = 0; i < 1000; i++) {
    r = random(-10, 10);
    theta = random(0, 360);
    x = r * sin(theta);
    y = r * cos(theta);
    circle(x - 40, y - 20, 2);
    circle(-x + 40, y - 20, 2);
  }
  fill(255);
  for (i = 0; i < 1000; i++) {
    r = random(-2, 2);
    theta = random(0, 360);
    x = r * sin(theta);
    y = r * cos(theta);
    circle(x - 37, y - 22, 2);
    circle(-x + 43, y - 22, 2);
    x = 1 * sin(theta);
    y = 1 * cos(theta);
    circle(x - 44, y - 19, 2);
    circle(-x + 36, y - 19, 2);
  }
  pop();
  fill(0);
  for (i = 0; i < 100; i++) {
    push();
    translate(200 * sin(15), 200 * cos(15));
    rotate(-15);
    theta = random(21.6, 22.4);
    r = random(0, 20);
    x = r * sin(theta);
    y = r * cos(theta);
    circle(x, y, 2);
    circle(-x, y, 2);
    circle(0, y, 2);
    pop();
    push();
    translate(200 * sin(-15), 200 * cos(-15));
    rotate(15);
    theta = random(17.8, 18.2);
    r = random(0, 20);
    x = r * sin(theta);
    y = r * cos(theta);
    circle(x, y, 2);
    circle(-x, y, 2);
    circle(0, y, 2);
    pop();
  }
}