Friday, January 9, 2015

Monday, November 17, 2014

Chapter Four

So I was trying to get the wave clock to work, however mine would only ripple over each other instead of turning. So I tried to add an extra for-loop and rotational translation, to make it spin, and I ended up with this funky sun/hurricane shape :)



Code:
float anglenoise, radiusnoise;
float xnoise, ynoise;
float angle = -PI/2;
float radius;
float strokeCol = 254;
float strokeChange = -1;
void setup()
{
 size(500,500);
smooth();
frameRate(30);
background(255);
noFill();

anglenoise = random(10);
radiusnoise = random(5);
xnoise = random(10);
ynoise = random(10);

}

void draw()
{
  float count =0;
 radiusnoise += 0.005;
radius = (noise(anglenoise)*200)-3;
if(angle>360)
{angle -=360;}
if(angle<0 angle="" p="">

for( float ang=0; ang<= 360; ang+=5){
xnoise += 0.01;
ynoise +=0.01;
//float centerX = width/2 + (noise(xnoise)*100)-50;
//float centerY = height/2 + (noise(ynoise)*100)-50;
float centerX = 0 + (noise(xnoise)*100)-50;
float centerY = 0 + (noise(ynoise)*100)-50;

float rad = radians(angle);
float x1 = centerX+ (radius * cos(rad));
float y1 = centerY+(radius *sin(rad));

float opprad = rad + PI;
float x2 = centerX+ (radius * cos(opprad));
float y2 = centerY+(radius *sin(opprad));

strokeCol+= strokeChange;
if(strokeCol>254){strokeChange= -1;}
if(strokeCol<0 strokechange="1;}</p">
stroke(strokeCol, 60);
strokeWeight(1);

pushMatrix();
    translate(width/2, height/2);
    rotate(radians(60+count));
    line(x1,y1,x2,y2);
    popMatrix();
count+=10;
}
}