The Task

We will practice our basic understanding of Procesing and polar coordinates. In class we build a simple polygon function. In this assignment you will produce a Processing program that will generate a series of random fading stars on a black backgound. We have covered in class all of the parts you need to know.

A k-pointed star is defined as we saw in class by using k points in a circle and connecting them as we go around the star in clockwise order skipping every s points. If we skip 0 points (s=0) then we draw a k sided polygon. If we skip 1 point then this is the way would normally draw a 5 pointed star for example. In class we built a function called polygon. polygon was defined:

void polygon(float posx, float posy, color c, int numPts, float size)

The Changes you need to Make

  1. ( 20 pt) Make a window that is 1000 by 800 with black background. Set the frame rate to 15 frames per second
  2. ( 40 pt) Create a star routine using the same drawing algorithm we used in class.
  3. ( 20 pt) Modify the parameter list to take these parameters in order: the position, color, size, number of points, and the number of points to skip as you go around the circle of points. For example, if the skip number is 0 then draw a polygon, if the skip number is 1 then skip over a point for each line drawn. So think carefully about how you compute the new point and old point using the algorithm we gave in class! Hint: Skipping 0 means you go to the next point in the circle. Note the parameters aren't all in the same order they were in class!
  4. ( 20 pt) Be sure things that are integer type are declared integer type in the parameter list and called with integers the function call.
  5. ( 20 pt) Every frame draw a star at a random location (center in the window), random color with full saturation and brightness, random size between 0 and upto 200, random number of sides between 3 and upto 12, and skipping between 0 and (number of sides)/2 - 1 points.
  6. ( 20 pt) Stroke weight should be 5. Use a semi-transparent black wash (fade) the screen to black with each frame of the movie. An alpha of 35 works well.
  7. (warning) If you do not indent properly or if I change the size of the window in the size function and your program doesn't adapt I will take off points!

Here is a movie of the program running.


Save your results as a .pde file and submit the file to the bblearn page.