| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ea1cf50 commit ef782fe
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | 2 | // Based on code 32-07 (p. 297) | |
| 3 | 3 | ||
| 4 | + import processing.pdf.*; | ||
| 4 | 5 | ||
| 5 | 6 | float inc = 0.0; | |
| 6 | 7 | ||
@@ -12,11 +13,11 @@ void setup() { | |||
| 12 | 13 | } | |
| 13 | 14 | ||
| 14 | 15 | void draw() { | |
| 15 | - | ||
| 16 | + | ||
| 16 | 17 | if(record) { | |
| 17 | 18 | beginRecord(PDF, "page_290.pdf"); | |
| 18 | 19 | } | |
| 19 | - | ||
| 20 | + | ||
| 20 | 21 | stroke(0, 143); | |
| 21 | 22 | randomSeed(0); | |
| 22 | 23 | background(255); | |
@@ -33,12 +34,12 @@ void draw() { | |||
| 33 | 34 | tail(i, 300, int(random(5, 12)), angle*random(1.0, 1.3)); | |
| 34 | 35 | tail(i, 400, int(random(5, 12)), -angle*random(1.0, 1.3)); | |
| 35 | 36 | } | |
| 36 | - | ||
| 37 | + | ||
| 37 | 38 | if(record) { | |
| 38 | 39 | endRecord(); | |
| 39 | - record = false; | ||
| 40 | + record = false; | ||
| 40 | 41 | } | |
| 41 | - | ||
| 42 | + | ||
| 42 | 43 | } | |
| 43 | 44 | ||
| 44 | 45 | void mousePressed() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | 2 | // Based on code 33-14 (p. 307) | |
| 3 | 3 | ||
| 4 | + import processing.pdf.*; | ||
| 4 | 5 | ||
| 5 | 6 | float inc = 0.0; | |
| 6 | 7 | ||
@@ -17,7 +18,7 @@ void setup() { | |||
| 17 | 18 | size(180, 666); | |
| 18 | 19 | smooth(); | |
| 19 | 20 | noFill(); | |
| 20 | - strokeWeight(0.25); | ||
| 21 | + strokeWeight(0.25); | ||
| 21 | 22 | y = new float[height]; | |
| 22 | 23 | x = new float[height]; | |
| 23 | 24 | ||
@@ -32,9 +33,9 @@ void draw() { | |||
| 32 | 33 | background(255); | |
| 33 | 34 | ||
| 34 | 35 | // Shift the values to the right | |
| 35 | - for (int i = y.length-1; i > 0; i--) { | ||
| 36 | + for (int i = y.length-1; i > 0; i--) { | ||
| 36 | 37 | y[i] = y[i-1]; | |
| 37 | - } | ||
| 38 | + } | ||
| 38 | 39 | // Add new values to the beginning | |
| 39 | 40 | my += (mouseX-my) * 0.1; | |
| 40 | 41 | y[0] = my; | |
@@ -46,9 +47,9 @@ void draw() { | |||
| 46 | 47 | endShape(); | |
| 47 | 48 | ||
| 48 | 49 | // Shift the values to the right | |
| 49 | - for (int i = x.length-1; i > 0; i--) { | ||
| 50 | + for (int i = x.length-1; i > 0; i--) { | ||
| 50 | 51 | x[i] = x[i-1]; | |
| 51 | - } | ||
| 52 | + } | ||
| 52 | 53 | // Add new values to the beginning | |
| 53 | 54 | mx += (mouseY-mx) * 0.1; | |
| 54 | 55 | x[0] = mx; | |
@@ -62,7 +63,7 @@ void draw() { | |||
| 62 | 63 | ||
| 63 | 64 | if(record) { | |
| 64 | 65 | endRecord(); | |
| 65 | - record = false; | ||
| 66 | + record = false; | ||
| 66 | 67 | } | |
| 67 | 68 | ||
| 68 | 69 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,27 +1,28 @@ | |||
| 1 | 1 | ||
| 2 | 2 | // Based on code 45-04 (p. 424) | |
| 3 | 3 | ||
| 4 | + import processing.pdf.*; | ||
| 4 | 5 | ||
| 5 | 6 | void setup() { | |
| 6 | - size(513, 666); | ||
| 7 | + size(513, 666); | ||
| 7 | 8 | } | |
| 8 | 9 | ||
| 9 | 10 | void draw() { | |
| 10 | 11 | if (mousePressed == true) { | |
| 11 | 12 | point(mouseX, mouseY); | |
| 12 | 13 | println("hi"); | |
| 13 | 14 | } | |
| 14 | - } | ||
| 15 | + } | ||
| 15 | 16 | ||
| 16 | 17 | void mousePressed() { | |
| 17 | - beginRecord(PDF, "page_420.pdf"); | ||
| 18 | + beginRecord(PDF, "page_420.pdf"); | ||
| 18 | 19 | background(255); | |
| 19 | 20 | stroke(0); | |
| 20 | 21 | strokeCap(ROUND); | |
| 21 | 22 | } | |
| 22 | 23 | ||
| 23 | 24 | void mouseReleased() { | |
| 24 | - endRecord(); | ||
| 25 | + endRecord(); | ||
| 25 | 26 | } | |
| 26 | 27 | ||
| 27 | 28 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments