Difference between revisions of "CSC103 Homework 5 2012"
(→Requirements) |
|||
Line 21: | Line 21: | ||
=Requirements= | =Requirements= | ||
* Your sketch must generate the rectangles that we see in the back of the sketch. | * Your sketch must generate the rectangles that we see in the back of the sketch. | ||
− | * The rectangles must touch | + | * The rectangles must touch each other. |
− | * The rectangles must be of varying color | + | * The rectangles must be of varying color. |
− | * The number of rectangles is up to you. | + | * The number of rectangles is up to you. You need at least 10. |
* Your sketch must display two columns of circles. | * Your sketch must display two columns of circles. | ||
− | * The circles should fit inside the rectangles. They can be smaller than the width | + | * The circles should fit inside the rectangles. They can be exactly the width of a rectangle, or they can be smaller than the width. |
* The circles can be of any color you want, but not the same color as the rectangle underneath them. | * The circles can be of any color you want, but not the same color as the rectangle underneath them. | ||
* There should be two columns of circles, one to the left, one to the right. | * There should be two columns of circles, one to the left, one to the right. |
Revision as of 16:24, 1 March 2012
--D. Thiebaut 16:55, 29 February 2012 (EST)
This homework is due on March 7th, 2012, at 9:00 a.m. in class. You can (and are encouraged) to work on this homework in pairs. If you work in pairs, you must find time to work together, and not allow one person to work on the program on his or her own.
Processing Sketch
- Run the video above. This is what your sketch needs to do.
Requirements
- Your sketch must generate the rectangles that we see in the back of the sketch.
- The rectangles must touch each other.
- The rectangles must be of varying color.
- The number of rectangles is up to you. You need at least 10.
- Your sketch must display two columns of circles.
- The circles should fit inside the rectangles. They can be exactly the width of a rectangle, or they can be smaller than the width.
- The circles can be of any color you want, but not the same color as the rectangle underneath them.
- There should be two columns of circles, one to the left, one to the right.
- The length of the left column should be controlled by the position of the mouse.
- Similarly for the right column of circles.
- The left column must grow from the bottom up
- The right column from the top down.
Hints on how to start with this sketch
Here is how I would recommend you start:
- generate rectangles that are stacked up one on top of the other. You know how to generate a stack of circles (from the lab), so you should be able to generate a stack of rectangle. By the way, the solutions for all the challenges from the Processing lab have been added at the bottom of the lab. Check them out!
- Look at the sketch where you had to change the color of the circles in the lab. Use this method to change the color of the rectangles. You do not have to make them go from green to red, as in the video. Figure out something that makes them go from one color to another. Avoid white...
- Then generate a column of orange circles in the middle of the window, as you did in the lab.
- Adjust the dimensions of the circles so that they each fall inside a rectangle.
- Adjust the locations of the circles so that they are close to the left of the window.
- Generate another column of circles and put them on the right side of the window.
- Once everything works well, make the display of the left column dependent on the location of the mouse.
- Adjust that solution so that it also controls the right-side column.
- You're done!
Submitting the Homework
- For this homework you will not need to hand anything out in class. Instead you will submit your homework on the Web. You must do so at the latest just before coming to class on Wednesday.
- When you are done with your sketch and are ready to submit it, do the following:
- Add your name(s) at the top of your sketch, behind two slashes, as follows:
// Alex Andra // Malena Vlady void setup() { size( 600, 600 ); smooth(); } void draw() { ... ...
- Copy your sketch in its entirety to the clipboard.
- Go to this URL: http://maven.smith.edu/~103b/submit5.htm
- Enter the 2 letters that define your user Id (or the user Id of your partner) for the Wiki system in the box.
- Paste your sketch in the text area
- Click on the upload button.