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;
}
}


Monday, November 3, 2014

Wrong Way To Draw A Circle (Chapter 4)


Spiral with randomness and noise

Wrong Way To Draw A Line (Chapter 3)


Data, XML, and 2D Transformations

Data:

I reviewed the importing, exporting, writing and reading from files, which was similar to what we did in AP. Like Julia, I was very confused when I got to the XML part of it.

2D Transformations

I made a waddling penguin (code in comments for motion)








Sunday, November 2, 2014

Chapter 3

"Wrong Way to Draw Lines"

Breaking a line into different fragments and adding a random noise element to the line.

Data and XML Format

Data:
So I practiced importing data from .txt files, like we've done previously in AP comp sci, but I was very confused about the whole XML format and when/why we would use it. I know this is last minute before the quarter ends, but next time we meet do you think we could go over a few things?

2-D Translations

2-D translations:

My feeble attempt to make a dog with a wagging tail:
How could I make the tip of the tail move back and forth without the whole thing moving?
(I'll put my code in the comments)

Also could maybe go over some of the input methods like atan2() that uses the mouse's position?