Saturday, August 2, 2008

Homework 5

Please use what you already know about drawing and animating shapes along with your new knowledge of arrays and functions to write a program. You can modify a program you have already written or write a new one from scratch. It can be animated or static.

Remember arrays are like lists. You could write a function that draws a shape where the point's values are held in arrays or you could use an array to assign values to your function's parameters in a for loop that calls the function.

Good luck and have fun with the assignment!

Daisey Function Code



If you play with the code and enter different values in the daisy function's parameter's you might find the results a bit strange. The reason for this is the way the original daisy is drawn. Because we are using pushMatrix(); and popMatrix(); the daisy is being moved relative to it's original position within the window. The original position is the center of the window. When using these functions it's better to draw the shape at the top left of the window, this way all changes are relative to the point 0, 0.

If you want you could try to modify the daisy function so it draws the daisy at the top left corner of the window, then see how much easier it is to position.

If none of what I am saying makes sense than I recommend cutting and pasting this code into processing and using the daisy function to draw some daisy's.


void setup () {
size (500,500);
background (13,121,43);
ellipseMode (CENTER);
smooth ();
}

void draw () {
daisy(-50, -150, 0, 1);
daisy(-150, -150, 0, 1.6);
daisy(600, 75, 1.5, 1);
daisy(400, 5, 1, .4);
}

void daisy(int x, int y, float r, float scale) {
pushMatrix();
translate(x, y);
scale(scale, scale);

rotate(r);


//this part draws the daisy
stroke (100, 255, 0);
strokeWeight(4);
line(250, 250, 350, 500);
stroke (0);
strokeWeight(1);
fill (255);
ellipse (250, 200, 100, 150);
ellipse (300, 250, 150, 100);
ellipse (250, 300, 100, 150);
ellipse (200, 250, 150, 100);
fill (220, 160, 0);
ellipse (250,250,100,80);
popMatrix();

}

Friday, August 1, 2008

homework 4

This is an example of keyboard strokes (except i missed the directions of the circle and kinda used a triangle! sorry!

DAY 5 CODE - NOUR DIAB YUNES

http://a.parsons.edu/~diabn122/bootcamp/processing/day5_code/applet/index.html

HW2 Flower Taxis-Thai Le


homework_04 from Danny Chang

Control the circles with keyboard.  when you click it will create a random circles.  if you keep pressing the mouse, it will keep rendering the images continuously.  ;) 

HW4 Joon


You can control it with up, down, left, right key.