FSEM 131
Lab 2 |
Variables and Scale
Independent Drawing |
Part I
Review your class notes and the reading Variables chapter posted on Moodle to answer the first questions; read the Arithmetic, Functions chapter also on Moodle before completing the last three questions. These programming questions are the ones you can find at the end of the pdf files you read. Don't forget to include comments. 0. [0 pt] Think about different types of numbers you use daily and write them
down. Are they integer or floating-point numbers?
Create a New
Processing sketch using the Processing application.
Save your file as exp1.pde
.
1. [2 pts] Make a few int
and float
variables (at least
a couple of each). Try assigning them in different ways. Write the values to the console
with println()
.
2. [3 pts] Within the same file create a composition that scales proportionally
with difference window sizes. Your composition should use at least three different
types of shape. Put different values into size()
to test.
Prior to answer this question you have to understand the concept of built-in variables,
which is explained in the reading.
width
and height
are pre-defined
variables provided by the Processing library, taking the hard-coded values the
first line size()
call or your program provide.
3. [3 pts] In a new file ellipses.pde
use variables to set the position and
size for three ellipses.
(You don't have to use loops, i.e. repeating similar line of code is okay for now)
They should attempt to form a pattern, having some sort of relationship among them.
(Three ellipses completely on top of each other are not acceptable; ellipses randomly
placed and/or sized neither.)
4. [4 pts] In a new file lines.pde
use multiplication to create a series of
lines with increasing space between them. The lines should change appearance in the series,
color and/or thickness using variables (not just hard coded different values).
Duplicate the three .pde
files in a common folder so as to create a zip
file that you submit on Moodle.
Part II
In class we use variable definitions to easily change parts of the bunny face and I distributed a code example of a pear, which drawing is defined in terms of variables such that its scale in relation to the window size. In Make (the third required book for this class) study and compare
-
Robot 1: Draw
example on pages 32 and 33 -
Robot 2: Variables
example on pages 47 and 48
- [4 pts] to design or copy a character of your choice, it can be robot or a puppet, be imaginative. It is required to have at least 4 parts, using different shapes and colors. Generally a body/torso, head, limb to move and eyes are the strict miniumum.
- [6 pts] to draw your design on a grid paper as is (before a scale, like in the Make book p 32) and then indicate how defining it in terms of variables it would change its appearance in your code
- [10 pts] to code your droid in Processing in the style of Robot 2 in Make.
droid.pde
on Moodle before class. Hand-in your design/drawing
at the beginning of class.
You can find graph paper outside my office.