Life as Clay

Woven

with one comment


I kept playing with code and the sine wave. Interestingly, when I set y = height/2, the first dot always appears at (0,0). That’s because it initializes before I set the size of the screen, I think. Anyhow, I hard coded it at 200 for the purpose of pasting it here:

woven

int x = 0;
float y = 200;

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

void draw() {
  fill(random(255),random(255),random(255));
  ellipse(x,y,5,5);
  
  x += 2;
  y = (200) + (20*sin(x));
}
Advertisements

Written by Clay

October 29, 2009 at 01:54

Posted in Code, Processing

Tagged with , ,

One Response

Subscribe to comments with RSS.

  1. i love this

    erika

    October 29, 2009 at 13:51


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: