Skip to content

Commit b23cf06

Browse files
committed
post-meeting updates
1 parent 054e1b6 commit b23cf06

File tree

6 files changed

+122
-121
lines changed

6 files changed

+122
-121
lines changed

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ This repo contains the curriculum in detail for every session (since we started
1313
- [Spring 2020](2020-04/)
1414
- [Fall 2019](2019-09/)
1515

16-
The working draft for the next class is located [in its own folder](draft/). Maintainers, at the beginning of the next class, duplicate this folder and rename it following the ISO date format: year, month, and day depending on what level of specificity is needed. Run the class from this folder and all hyperlinks will be perserved.
16+
### for maintainers
17+
18+
Each class is named after its start date. Include whatever level of Y-M-D specificity required. Create your folder before class begins so that all hyperlinks during class will be perserved long term.
19+
20+
The [draft for the next class](draft/) is located its own folder. It is an improved copy of the most recent session based on feedback and post-session meetings.

draft/02/readme.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
# Bootcamp 02
22

3-
split into groups and share homework
3+
15 minutes, split into groups and share homework
44

55
### animation, sine, map
66

77
two ways to approach animation:
88

9-
- animate a thing based on its previous position. we need the computer to remember; we need an attribute variable in the .h file.
10-
- there is a whole class of animations where the position (or whatever) is a **calculation** based on the current time. no variables needed!
9+
1. animate a thing based on its previous position. we need the computer to remember; we need an attribute variable in the .h file.
10+
2. there is a whole class of animations where the position (or color or whatever) is a **calculation** based on the current time. no variables needed!
1111

12-
start with #2.
12+
### 1. animation with memory
1313

14-
### sine of elapsed time
14+
store a circle's position in the .h file; two floats x and y. have it chase the mouse. ease towards the mouse. talk about multiplication, easing.
15+
16+
```c++
17+
float ease = 0.9;
18+
x = (x * ease) + (mouseX * (1-ease));
19+
```
20+
21+
### 2. animation from equations: sine of elapsed time
1522

1623
introduce `cout <<` to peek inside `ofGetElapsedTimef()`. animate a circle moving across the screen.
1724

@@ -24,7 +31,7 @@ float y = ofMap(sin(ofGetElapsedTimef(), -1, 1, 0, ofGetHeight()),
2431
ofDrawCircle(ofGetWidth() / 2, y, 10);
2532
```
2633
27-
talk about sine not in terms of trigonometry but simply as a [function that has an input and output](sine.gif) (*any* number ➜ between -1 and 1). work your way up to using ofMap.
34+
We aren't using sine as in trigonometry, but simply as a [function that has an input and output](sine.gif) (*any* number ➜ between -1 and 1). work your way up to using ofMap.
2835
2936
now map the the sine of elapsed time to colors, very simple, the background color.
3037
@@ -33,19 +40,12 @@ float color = ofMap(sin(ofGetElapsedTimef()), -1, 1, 0, 255);
3340
ofBackground(color);
3441
```
3542

36-
learn about phase. make these two sine of elapsed times oscillate at different rates.
37-
38-
### animation with memory
39-
40-
store a circle's position in the .h file; two floats x and y. have it chase the mouse. ease towards the mouse. talk about multiplication, easing.
41-
42-
```c++
43-
float ease = 0.9;
44-
x = (x * ease) + (mouseX * (1-ease));
45-
```
43+
with both of these in the same sketch, learn about phase. make these two sine of elapsed times oscillate at different rates.
4644

4745
### random
4846

47+
`ofGetElapsedTimef()` and `ofRandom()`, two ways of getting a different number each frame. Introduce time before random as it more represents classical animation.
48+
4949
for context, show some algorists' work: Molnar, Nees, Mohr, Nake, computer pseudo-randomness kind of had a moment in these decades.
5050

5151
```c++

draft/03/readme.md

+26-19
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,66 @@
11
# Bootcamp 03
22

3-
split into groups and share homework
3+
15 minutes, split into groups and share homework
44

55
### loops, arrays
66

77
introduction to boolean expressions, and how they result in a boolean variable. `5 < 10` turns into `true`
88

99
introduce loops first with the while loop. to prevent an infinite loop we need a boolean expression which begins as **true** but eventually becomes **false**. (we need variables. need to compare against memory and change the memory).
1010

11-
introduce for loops, connect the dots: 3 parameters in the for loop relate to the 3 lines of code using the while loop.
11+
introduce for-loops, connect the dots: 3 parameters in the for loop relate to the 3 lines of code using the while loop.
12+
13+
```c++
14+
start
15+
while (end) {
16+
increment
17+
}
18+
19+
for (start; end; increment)
20+
```
21+
22+
> tabs are whitespace that is ignored by the compiler but *extremely* helpful for human eyes. be strict about good tab spacing!
1223
1324
### how to not draw the same shape 100 times on top of itself
1425

15-
*challenge: pick a shape (rect, circle, ellipse) draw many shapes, make them different somehow*. did you use random?
26+
*challenge: pick a shape (rect, circle, ellipse) and put it in the for-loop. but how can you make it different every time*. ofRandom? ofGetElapsedTimef()
1627

17-
try this without random. how do we prevent drawing the same shape 100x times on top of itself? *we need something that changes within the loop. use the `i` iterator.*
28+
the for-loop comes with a built-in counter. *you need something that changes between each iteration of the loop? use the `i` iterator.*
1829

1930
*challenge: draw a color gradient by drawing a bunch of vertical lines next to one another* the `i` will be used to change the x-position of the lines, as well as the color.
2031

2132
*problem: both position and color are tied to the same variable, how can we make this gradient larger in size than 255, without breaking the colors?* we need ofMap.
2233

2334
right now the `i` is too-directly mapped to the location. we can use math (`* 2`) to increase the size. why is our for-loop between 0 and 255 to begin with?
2435

36+
> for-loops and the draw() function are different kinds of loops. the for-loop completely finishes all in the span of nano or micro seconds. the draw() loop waits **an eternity** in computer time, 1/60th of a second (in most cases).
37+
2538
### harmonic motion
2639

2740
a sketch where sine of elapsed time is mapped to position. and play with the frequency of the sine function.
2841

2942
```c++
3043
ofBackground(0);
3144
for (int i = 0; i < 20; i++){
32-
float y = ofMap(sin(ofGetElapsedTimef()*i*0.2), -1, 1, ofGetHeight()/2-100, ofGetHeight()/2+100);
33-
ofDrawCircle(i * 50, y, 20);
45+
float y = ofMap(sin(ofGetElapsedTimef()*i*0.2), -1, 1, ofGetHeight()/2-100, ofGetHeight()/2+100);
46+
ofDrawCircle(i * 50, y, 20);
3447
}
3548
```
3649
3750
### Arrays
3851
39-
arrays are a way of storing a list of variables. it solves the problem for how can we store one variable for every iteration of the loop.
52+
*challenge: inside a for-loop, place 100 random tiny dots, creating the night-sky.* it's impossible because every frame, a randomly placed dot changes positions!
4053
41-
### watch this video: [introduction to arrays](https://www.youtube.com/watch?v=6PxIhuwvQ_4)
42-
43-
your homework is to play with for-loops, arrays, and random together.
44-
45-
- make a starry-night sky. can you make the stars twinkle?
46-
- can you make a rainy sky? (this is a little more advanced than stars)
47-
48-
alternatively, try playing with loops and arrays without using random to make more regular, geometric kinds of drawings.
54+
can you imagine writing out 100 variables? `int x1; int x2; int x3`...
4955
56+
arrays are a way of storing a list of variables. it solves the problem how can we store one variable for every iteration of the loop.
5057
51-
### other things:
58+
### watch this video: [introduction to arrays](https://www.youtube.com/watch?v=6PxIhuwvQ_4)
5259
53-
you should know `while(random(10) < 1)` does not do what you probably think it does.
60+
> you should know `for(int i = 0; i < random(10); i++)` does not do what you probably think it does.
5461
5562
## Homework
5663
57-
have fun with harmonic animation, sine of elapsed time in a loop, with the `i` modifying each instance.
64+
the iterator in the for loop counts 0 to whatever is the upper limit. play with a for-loop that represents 2 things at once (or 3, or more..), the iterator needs to be mapped. Consider the ranges of the mapped iterators (0...PI, 0...ofGetWidth(), -1...1). Play with different ranges and different increments.
5865
59-
expand your bouncing ball into a particle class. can you give each particle a unique direction, speed, color?
66+
have fun with harmonic animation, sine of elapsed time in a loop, with the `i` modifying each instance.

draft/04/readme.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Bootcamp 04
22

3+
15 minutes, split into groups and share homework
4+
35
### branching, classes
46

57
Here is an example of an animation based on asking the computer to *remember* the last position. create the bouncing screen saver (bouncing DVD logo). key take aways:
@@ -12,13 +14,13 @@ x = x + 1;
1214
// here, check if it went off screen
1315
```
1416

15-
we need if statements to catch the ball from moving off screen. an if statement is like our while loop where the () contains a boolean expression, and only runs if true.
17+
we need if-statements to catch the ball from moving off screen. an if statement is like our while loop where the () contains a boolean expression, and only runs if true.
1618

1719
```c++
1820
x = x + 1;
1921

2022
if (x > ofGetWidth()) {
21-
// what here?
23+
// what here?
2224
}
2325
```
2426

@@ -39,7 +41,7 @@ now, what if we need `ofBackground` to be on? *we need to store **all** of the p
3941

4042
### polyline
4143

42-
recode our draw app with an ofPolyline. show off some tricks that polyline can do, like smoothing.
44+
recode our draw app with an ofPolyline. show off some tricks that polyline can do, like smoothing. Polylines are great, and are present in other places like fonts (see **typography** section below).
4345

4446
## ofImage and transforms
4547

@@ -55,9 +57,11 @@ Many different variables in this bounce sketch conceptually relate to the same t
5557

5658
re-code our bounce project into a custom particle class. [the solution is in this video](https://www.youtube.com/watch?v=efpIiXcy5tM).
5759

58-
expand it by creating an **array of particles**. (this gets really fun when you add gravity!) make an array of particles generate on a mouse click to look like welding sparks or fireworks.
60+
expand upon the assignment by creating an **array of particles**. (this gets really fun when you add gravity!) make an array of particles generate on a mouse click to look like welding sparks or fireworks.
61+
62+
can you add parameters to your class, giving each particle a unique direction, speed, color?
5963

60-
## typography
64+
### typography
6165

6266
bonus video content, [getting a polyline from a font](https://www.youtube.com/watch?v=A-_0AhArveM).
6367

draft/05/readme.md

+29-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Bootcamp 05
22

3+
15 minutes, split into groups and share homework
4+
35
### 3D, pixels, recursion
46

57
15 minutes of share work time, 3-4 person groups.
@@ -10,14 +12,14 @@ load an image and read its pixels with `getColor`, learn about the `ofColor` obj
1012

1113
```c++
1214
void ofApp::draw(){
13-
ofBackground(0);
14-
img.draw(0,0);
15-
for (int i = 0; i < img.getWidth(); i+=10){
16-
for (int j = 0; j < img.getHeight(); j+=10){
17-
float brightness = img.getColor(i,j).getBrightness();
18-
ofDrawCircle(img.getWidth()+i, j, ofMap(brightness, 0, 255, 0, 5));
19-
}
15+
ofBackground(0);
16+
img.draw(0,0);
17+
for (int i = 0; i < img.getWidth(); i+=10){
18+
for (int j = 0; j < img.getHeight(); j+=10){
19+
float brightness = img.getColor(i,j).getBrightness();
20+
ofDrawCircle(img.getWidth()+i, j, ofMap(brightness, 0, 255, 0, 5));
2021
}
22+
}
2123
}
2224
```
2325

@@ -40,15 +42,15 @@ talk about how recursion is similar to and unlike a loop. we need to repeat for
4042

4143
```C++
4244
void ofApp::splitRectangle(float x, float y, float width, float height){
43-
if (width > 1 && ofRandom(0, 1) > 0.5){
44-
splitRectangle(x , y , width/2, height/2);
45-
splitRectangle(x + width/2, y , width/2, height/2);
46-
splitRectangle(x + width/2, y + height/2, width/2, height/2);
47-
splitRectangle(x , y + height/2, width/2, height/2);
48-
} else {
49-
ofDrawRectangle(x,y,width, height);
50-
}
51-
//ofDrawRectangle(x,y,width, height);
45+
if (width > 1 && ofRandom(0, 1) > 0.5){
46+
splitRectangle(x , y , width/2, height/2);
47+
splitRectangle(x + width/2, y , width/2, height/2);
48+
splitRectangle(x + width/2, y + height/2, width/2, height/2);
49+
splitRectangle(x , y + height/2, width/2, height/2);
50+
} else {
51+
ofDrawRectangle(x,y,width, height);
52+
}
53+
//ofDrawRectangle(x,y,width, height);
5254
}
5355
```
5456
@@ -60,17 +62,17 @@ Rotate the grass-colored plane to lie flat. discuss the three axes parameters of
6062
6163
```c++
6264
void ofApp::draw(){
63-
cam.begin();
64-
ofSetColor(100, 20, 10); // brown
65-
ofDrawBox(0, 50, 0, 100, 100, 100);
66-
67-
ofPushMatrix();
68-
ofSetColor(50, 190, 10); // green
69-
ofRotateDeg(90, 1, 0, 0);
70-
// ground plane
71-
ofDrawRectangle(-250, -250, 500, 500);
72-
ofPopMatrix();
73-
cam.end();
65+
cam.begin();
66+
ofSetColor(100, 20, 10); // brown
67+
ofDrawBox(0, 50, 0, 100, 100, 100);
68+
69+
ofPushMatrix();
70+
ofSetColor(50, 190, 10); // green
71+
ofRotateDeg(90, 1, 0, 0);
72+
// ground plane
73+
ofDrawRectangle(-250, -250, 500, 500);
74+
ofPopMatrix();
75+
cam.end();
7476
}
7577
```
7678

0 commit comments

Comments
 (0)