Creative Programming - Workshop 02: Mathias Funk (ID DI), Fall 2012
Creative Programming - Workshop 02: Mathias Funk (ID DI), Fall 2012
What we do today
Shapes
Colors +
Coordinates
Transforming
shapes
Animating
shapes
Shapes
Coordinate system
size(200, 200);
(0,0)
(50,150)
(200,200)
6
Shapes
Triangle
rectMode(CORNERS);
rectMode(CENTER);
rectMode(RADIUS);
ellipseMode(CORNERS);
ellipseMode(CENTER);
ellipseMode(RADIUS);
Colors
10
When all values are same you will get grayscale colors (or white or black).
fill(120) is a shortcut for fill(120, 120, 120)
11
Colors...
12
Colors, really
13
noStroke();
stroke(0,255,0);
14
smooth();
noSmooth();
15
Transforming shapes
16
Transformations?
translate
scale
rotate
17
Translate
18
Scale
19
Rotate
Hint: rotate(radians(30));
20
Transformation UNDO
21
Polygon shapes
22
23
24
void setup( ) {
size(200, 200);
}
just once
on start up
every frame,
this happens
void draw( ) {
// erase background
background(0);
// draw some stuff
// ...
}
void setup( ) {
size(400, 400);
}
void draw( ) {
// erase background
background(0);
// add 1 to variable
x = x + 1;
// draw a rectangle of 20 by 20 pixels
rect(x, x, 20, 20);
}
just once
on start up
every frame
this happens
26
Exercises
27
Books
Must-have
Getting Started with Processing, by By Casey Reas, Ben Fry
e-Book and hard copy available from O'Reilly
Recommended-to-have
Learning Processing: A Beginner's Guide to Programming Images, Animation, and Interaction
Daniel Shiffman.
Published August 2008, Morgan Kaufmann. 450 pages. Paperback.
Available from LUCID, or from Amazon
Programming Interactivity: A Designer's Guide to Processing, Arduino, and openFrameworks (Paperback) by Joshua Noble
(Author). Very good one, covers many topics in Competency II.
Available from LUCID. Also see http://programminginteractivity.com
Processing: Creative Coding and Computational Art (Foundation)
Ira Greenberg (Foreword by Keith Peters).
Published 28 May 2007, Friends of Ed. 840 pages. Hardcover.
Available from LUCID
Making Things Talk: Practical Methods for Connecting Physical Objects
Tom Igoe.
Published 28 September 2007, O'Reilly. 428 pages. Paperback.
Available from LUCID
28
More help...
http://wiki.id.tue.nl/creapro/
29