FSEM 131
Lab 4 |
Variables/Loops
Animation |
Due Thursday November, 15
Using the Processing language/environment fix and extend the provided program. Your code should use variables, loops and functions.
Run the provided program:
copy and paste in your own processing sketch called flower
.
The program produces the following image.
1. [8 pts] After reading the provided code, modify the code to create the same output but in a better style. Among other things you have to make the following updates. Don't forget to run and debug throughout.
- declare and use a variable
petalSize
(intead of having a magic number throughout) - remove the duplicate/similar code by creating the petals using a loop (
for/while
your choice) - check your improved code work for a different
numberOfPetals
value - convert the code to interactive mode (using
setup/draw
) functions.
2. [2 pts] Once your done fixing the program style, change variable values to modify your flower look. For example below is a minimal change. I encourage you to be creative.
(The image has transparency: an alpha is used for the yellow.)
3. [4 pts] Add a stem and leaves of your design. Below is just a model.
4. [6 pt] Animate the flower so the petals turn around the pistil.