Drawing #2 & #3 – Abbie

on

Here are my drawings 2 and 3. I decided to draw a vinyl turntable for my drawing 2 since I like to collect vinyl records and own a turntable speaker set. The blue color represents engraving, and the red color represents cutting. I don’t know why For drawing #3, I drew a bunch of circles surrounding round after round, I struggled a bit to get this code done exactly what I want though.

Below are the code I use to create multiple rounds of circles.

function setup() {
  createCanvas(600, 600);
}

function draw() {
  background(220);

  // Center circle
  let centerX = width / 2;
  let centerY = height / 2;
  let centerRadius = 50;

  noFill(); // Blue color for the center circle
  ellipse(centerX, centerY, centerRadius * 2, centerRadius * 2);
  ellipse(centerX, centerY, centerRadius * 1.8, centerRadius * 1.8);
  ellipse(centerX, centerY, centerRadius * 1.6, centerRadius * 1.6);
  ellipse(centerX, centerY, centerRadius * 1.4, centerRadius * 1.4);
  ellipse(centerX, centerY, centerRadius * 1.2, centerRadius * 1.2);
  ellipse(centerX, centerY, centerRadius * 1.0, centerRadius * 1.0);

  // First surrounding round (8 circles)
  drawSurroundingCircles(centerX, centerY, centerRadius, 8, 100, color(255, 0, 0));

  // Second surrounding round (16 circles)
  drawSurroundingCircles(centerX, centerY, centerRadius + 20, 16, 150, color(0, 255, 0));
  drawSurroundingCircles(centerX, centerY, centerRadius + 40, 8, 200, color(0, 255, 0));
}

function drawSurroundingCircles(centerX, centerY, centerRadius, numCircles, surroundingRadius, circleColor) {
  let angleIncrement = TWO_PI / numCircles;

  noFill();

  for (let i = 0; i < numCircles; i++) {
    let x = centerX + cos(angleIncrement * i) * surroundingRadius;
    let y = centerY + sin(angleIncrement * i) * surroundingRadius;
    ellipse(x, y, centerRadius * 2, centerRadius * 2);
  }
}

Leave a Reply