Life as Clay

Brain Warmer

leave a comment »


I have a tendency to have ideas that are larger than my implementation capacity. That leads to frustration, which leads to inaction, which leads to surfing the Internet for long periods of time without accomplishing anything. This was a brain warmer, to get me comfortable at the desk and thinking.

random circles smallrandom circles medium

int startX = 0;
int startY = 0;
int maxDiam = 80;
int squareSize = 80;

void setup() {
  background(255);
  size(400,400);
  noStroke();
  smooth();
}

void draw() {
  drawBall(startX, startY, maxDiam);
  
  
  // move to the next start position on the current row
  startX += squareSize;
  
  // Move to the next row
  if (startX >= width) {
    startX = 0;
    startY += squareSize;
  }
}

void drawBall(int startX, int startY, int maxDimension) {
  
  float diam;
  diam = random(maxDimension/10,maxDimension);
  
  fill(random(0,240), random(0,240), random(0,240));
  ellipseMode(CORNER);
  ellipse(startX, startY, diam, diam);
}
Advertisements

Written by Clay

November 2, 2009 at 16:14

Posted in Code, Processing

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: