Creating artwork

For this assignment, I created an artwork where you can see a group of wheel-looking objects rotating in different sizes. Personally, this resembles the solar system because the wheels seem to have their own orbits and rotations in place. The wheels are comprised of equally sized rectangles and they create an effect that looks like pulses. Enjoy!

float c1 = random(255);
float c2 = random(255);
float c3 = random(255);
float c4 = random(255);
float c5 = random(255);

void setup() {
  size(640, 360);
}

void draw() {
  background(c1, c2, c3);
  
  pushMatrix();
  translate(width*0.5, height*0.5);
  rotate(frameCount / 20.0);
  ring(c1, c2, c3, 1, 20, 20, 1, 50, 20, 0.01, 0.01);
  popMatrix();
  
  pushMatrix();
  translate(width*0.5, height*0.5);
  rotate(frameCount / 200.0);
  ring(c2, c4, c1, 5, 70, 20, 1, 100, 100, 0.1, 0.1);
  popMatrix();
  
  pushMatrix();
  translate(width*0.5, height*0.5);
  rotate(frameCount / 50.0);
  ring(c3, c5, c2, 10, 50, 50, 5, 50, 100, 0.1, 0.01);
  popMatrix();
  
  pushMatrix();
  translate(width*0.5, height*0.5);
  rotate(frameCount / 100.0);
  ring(c4, c1, c3, 20, -200, 200, 10, 200, 100, 0.01, 0.01);
  popMatrix();
  
  pushMatrix();
  translate(width*0.5, height*0.5);
  rotate(frameCount / 100.0);
  ring(c5, c1, c2, 16, -120, 120, 10, 200, 200, 0.01, 0.1);
  popMatrix();
  
}

void ring(float col, float col2, float col3, int h, float x, float y, float radius, int npoints, float amplitude, float speed, float granular) {
  randomSeed(0);
  stroke(0);
  fill(col, col2, col3);
  float angle = TWO_PI / npoints;
  for (float a = 0; a < TWO_PI; a += angle) {
    float sx = x + cos(a) * radius;
    float sy = y + sin(a) * radius;
    float freq = frameCount*speed + (x * granular);
    float adjustedHeight = noise(freq);
    adjustedHeight -= .5;
    adjustedHeight *= amplitude;
    pushMatrix();
    translate(sx, sy);
    rotate(a);
    rect(a+sx, sy, 8, h + adjustedHeight);
    popMatrix();
  }
}

void mousePressed () {
  if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
    c1 = random(255);
    c2 = random(255);
    c3 = random(255);
    c4 = random(255);
    c5 = random(255);
  }
}

 

Leave a Reply