Introduction� NOTE: �This is a real chapter
Processing Programming
Introduction
MAIN POINTS
A Few Definitions
Don’t write down definitions, maybe just words.
Chapter 1�PIXELS
X & Y Coordinates
NOTE: �100 pixels equals approx. 1"
X axis +
+ Y axis
(0,0)
Coordinate Systems
Cartesian
Processing
Simple shapes
In order to “give a command” to tell it to draw a shape, we use built-in functions.
functionname(arguments);
Example of rectangle function showing parameters, then values.
rect(x, y, width, height);
rect(30, 40, 20, 50);
Examples: point, line, ellipse, rectangle, quad
More definitions
Don’t write down definitions. Maybe just words.
Do exercise on graph paper
Oops, the last number
should be 200
See specifics on next slide
Line(x1, y1, x2, y2);� line(20, 20, 180, 20);
Point(x, y);
strokeWeight(5);
point(50, 50);
point(0, 80);
rect(x, y, width, height);
rect(100, 100, 100, 100);
Same as rectangle but from the center
ellipse(25, 90, 50, 50);
TRY IT: ��Let's input your shapes from the graph paper into Processing!
Note: �Make screen size 200 x 200
Color
0 50 87 162 209 255
TRY IT: �Create these rectangles in grayscale colors
Set screen size to 300. Then try to guess what the instructions would be for the following screenshot.
Textbook Exercise 1-4
Using full RGB colors:
COLOR (continued):
background(0, 255,255);
QUESTION FOR YOU:
What is used to control transparency of colors?
COLOR (continued):
background(#00FFFF);
fill(#FF0000);
stroke(#C80096);
Challenge: Extension of Exercise 1-4
Quick Answer:
size(300, 300);
fill(0);
rect(0, 0, 150, 150);
fill(0,255,0);
rect(150, 0, 150, 150);
fill(255,0,0);
rect(0, 150, 150, 150);
fill(255,255,0);
rect(150, 150, 150, 150);
strokeWeight(6);
fill(150, 25, 175, 110);
quad(150, 75, 225, 150, 150, 225, 75,150);
Exercise 1-7 … a reminder
Other ideas for Chapters 1 & 2
I kept these simplistic, but you can go further if desired. The idea is just to get your bearings right regarding shapes and coordinates.
Even more ideas. These are windows.
I saw this collection of windows on a vector drawing site. I re-created them in Processing. Try one! It helps to get you acquainted with coordinates and sizing for sure.
Not to overwhelm, but even more …
I’ve only recreated one of these in Processing, but I know that each of them is doable. Try one if you’re so inspired.
We’ve already touched on some of Chapter 2
Chapter 2 (Preview)