100x100 Computational Design Challenge

Throughout 2020 I created 100 computational designs in 100 days as a way to learn creative coding and explore generative art

Day 89 - Pompoms

pompom-4.png

It’s my birthday! 36 rainbow pompoms in each sketch to celebrate 36 years on this strange planet.

Sketch:

https://editor.p5js.org/chelseamwatson/present/tNdl-51uT


Drawings:


Code:

rad = 0;
i = 0;
count = 0;

function setup() {
  createCanvas(800, 800);
  background(245, 243, 240);
  rRad = random(20, 50);
  rR = random(0, 255);
  rG = random(0, 255);
  rB = random(0, 255);
  rX = random(-200, 200);
  rY = random(-200, 200);
}

function draw() {

  translate(width / 2, height / 2);

  var angle = TAU / 200;
  var x = cos(angle * i) * rad;
  var y = sin(angle * i) * rad;
  i = i + 2;

  if (x + rX < -200 || x + rX > 200 || y + rY < -200 || y + rY > 200) {
    stroke(245, 243, 240);
  } else {
    stroke(rR, rG, rB);
  }

  ellipse(x + rX, y + rY, 1);

  if (x == rad) {
    rad = rad + 2;
  }

  if (rad > rRad) {
    rad = 0;
    rX = random(-200, 200);
    rY = random(-200, 200);
    rRad = random(20, 50);
    rR = random(0, 255);
    rG = random(0, 255);
    rB = random(0, 255);
    count = count + 1
  }

  if (count == 36) {
    noLoop();
  }
}

Chelsea Watson