Wednesday, 20 August 2014

Processing
For my final composition in processing I played with for loops and random numbers. I created a for loop to create circles that would be different sizes that follow the mouse pointer, I also had the fill have random colours using the random() function with the alpha reduced so the circles are transparent. With all of this it created an effect where multiple different circle will be layered ontop of each other all of different colours and eventually as the colours build up they all blend into a blueish white. Because the start of the composition looks the best before the colours build up to much I added in a function so that when you press a key on the keyboard it will fill in the top layer with black so that you can keep painting with the circles. I also turned the frame rate down because if it was fully up the circles would overlap too much ruining the effect.
Here is the code of my composition.
void setup() {
  size(1000,1000);
  background(10,10,10);
  frameRate(30);
}

void draw() {
  noStroke();
  for (int i = 0; i < 5; i++) {
    float r = random(255);
    fill(random(150),random(100),random(90),2);
    ellipse(mouseX+i,mouseY-i,i-r,i-r);
  }

}
void keyPressed() {
  int keyIndex = -1;
  if (key == 'p') {
    keyIndex = key - 'A';
  } else if (key == 'o') {
    keyIndex = key - 'a';
  }
  if (keyIndex == -1) {
    background(0);
  } else {
    fill(mouseX,mouseY,125);
  }
}

And some screenshots showing the effects you can achieve with this composition.



No comments:

Post a Comment