Powered By Blogger

Thursday 7 April 2011

First concept of transformation.

Below is my code for a very basic looking cloud scenario...


[Inspired by David Bouchard on OpenProcessing, who used array's to store data. **Click Here** to see the source of inspiration.]


PImage img;



float x[] = new float[250];
float y[] = new float[250];

void setup() {
  size(500, 500);
 
  img = loadImage("http://www.freefoto.com/images/9907/04/9907_04_20---Blue-Sky-and-White-Clouds_web.jpg?&k=Blue+Sky+and+White+Clouds");

  smooth();
  noStroke();

  for (int i=0; i < x.length; i++) {
    x[i] = random(width);
    y[i] = random(height);
  }
}

void draw() {
 
  background(40,75,155,100);
 
  for (int i=0; i < x.length; i++) {
   
    smooth();
    int a=floor(random(0,img.width));
    int b= floor(random(0,img.height));

    color myColor = img.get(a,b);
   
    float dia = dist(x[i], y[i], mouseX, mouseY);
    fill(myColor,random(1,45));
    ellipse(x[i], y[i], dia, dia);
  }


}

No comments:

Post a Comment