Wednesday, January 20, 2010

Squarillism

//Based on Ink by Johnny
  
PVector[] locations = new PVector[40];

void setup() {
  size(800, 600, P2D);
  background(0);
  noStroke();
  for(int i = 0; i < locations.length; i++) {
    locations[i] = new PVector(random(0, width), random(0, height));
  }
}

void draw() {
  for(int i = 0; i < locations.length; i++) {
      fill(locations[i].x/2, locations[i].y/2,random(0, 255),30);
    int rectSize = int(random(1,10));
    rect(locations[i].x + 400*sin(locations[i].x/10), locations[i].y + 300*sin(locations[i].y/10),rectSize,rectSize);
    locations[i].x += random(-1, 1);
    locations[i].y += random(-1, 1);
  }
}

    class PVector {
    float x, y;

PVector(float ix, float iy) {
  x = ix;
  y = iy;
}}

info info

submitted by: DARYL_Gamma
views: 652
Based on Ink by Johnny. No idea why the points accumulate along edges in that way, I must admit.

treeThis sketch has a parent
Tags:

comments comment

loading loading...

 

Add a comment: