Objectives

Upon completing this assignment, you will be able to:

Description

In the prior homework, you created a composition which would vary by changing the settings of several variables. In this homework, you will again create a varying composition, but in this case, all the variations will be controlled through a single parameter.

In this assignment, you will create a visual composition of 8 squares. At the top of your file, you will define a floating-point variable called "parameter," whose value may be initially assigned by me to be anywhere between 0.0 and 1.0 and whose value does not change again anywhere in your program. In your visual composition, you will have at least 4 different effects which change proportionately when the value of the parameter is changed. These effects will be constructed using mathematical expressions that depend on the value of parameter.

For example, one such change could be the grayscale level of the fill of one of the squares, which might vary from black to white according to the level of the parameter:

float grayFill = 255 * parameter; // grayFill varies from 0 to 255
fill(grayFill);
Or, you could get more fancy, and have the gray level vary between 100 and 200:
float grayFill = 100 + (100 * parameter); // grayFill varies from 100 to 200
fill(grayFill);
What you choose to change and how is up to your imagination.

Special note: Since the value of parameter could be set to 0, you should never divide by parameter - like people, Processing gets confused when you divide by 0. But you can divide by, for example, (parameter + 0.0001).

Requirements

Your composition must:

Instructions

You may proceed in any way that you wish to accomplish the requirements of this assignment. This suggested procedure may be helpful:

  1. Make an initial composition of 8 squares that does not vary.
  2. Add the declaration for the parameter at the top of your program. Give it an initial value between 0.0 and 1.0.
  3. Consider one thing the parameter could be used to change; for example, you may want to let it control the width of one of your squares, or all of them, to be within a certain range.
  4. Define a variable for the thing you want to be altered. Write a mathematical expression that uses 'parameter' and will result in the variable being set the way you want. Then, put the variable into the function call you want to adapt.
  5. Test your code by altering the value assigned to the parameter. At the least, try parameter = 0.0, parameter = 0.5, and parameter = 1.0.
  6. Repeat steps 3-5 until you have made 4 effects.

Grading scheme

A+ - All required elements included, plus an exciting visual composition that changes in interesting and creative ways.

A - All required elements included and functioning correctly. Parameter changes result in interesting alterations to the image. Code is easy to read.

B - Competent response to the assignment, with some small errors that do not greatly affect the quality of the assignment (for example, forgetting one of the visual elements, or the parameter does not work in a single special case).

C - Some bigger errors, but with potential to develop into a competent response. For example, the code may not run, but with a few small syntactical fixes would properly fulfill the assignment; the code may work but not be comprehensibly written; or the code completely misses on one or two of the requirements, but still shows some understanding of the unit's material.

D - Serious errors show clear effort, but serious gaps in understanding, such as code that does not run and is not close to being correct.

F - Little demonstrated effort, or clear effort with no understanding, such as code fragments submitted which are only the start of a response to the assignment.