Life as Clay

Tangent to a busy day

leave a comment »


Today was busy. I didn’t crack open the book today, but instead, just tried to create something interesting based on what I remembered, and playing with sine, cosine, and tangent. I found, interestingly, that if I tried to move the center point of an ellipse using random(-10,10) for both the x and y coordinates, that it ultimately would move toward the origin. That movement produced these:
yellow

red

aquaI like the last one… primarily for the color. :)

I changed to color variation and a line drawn using a random number based on the tangent of the center of the circle (for each iteration). It resulted in this:

staticErgly, as my high school Chinese teacher used to say, but interesting in that it tended towards the origin again. What’s up with the random() function that it tends towards the origin? Here the code for the last picture:

int z;
int x = 200;
int y = 200;

void setup() {
  size(400,400);
  background(0);
  noFill();
  strokeWeight(1);
}

void draw() {
  z = int(random(200));
  ellipseMode(CENTER);
  stroke(random(255),random(255),random(255),100);
  ellipse(x,y,z,z);
  
  x += random(-1,2);
  y += random(-1,2);
  
  stroke(random(255),random(255),random(255),100);
  line(width/2,height/2,tan(x)*random(400),tan(y)*random(400));
  
}

It ain’t gonna win me no prizes, but at least I’m learning.

 

Advertisements

Written by Clay

October 30, 2009 at 02:36

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: