| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,7 @@ | |||
| 6 | 6 | */ | |
| 7 | 7 | ||
| 8 | 8 | // The next line is needed if running in JavaScript Mode with Processing.js | |
| 9 | - /* @pjs preload="sea.jpg"; */ | ||
| 9 | + /* @pjs preload="sea.jpg"; */ | ||
| 10 | 10 | ||
| 11 | 11 | PImage img; | |
| 12 | 12 | int direction = 1; | |
@@ -23,22 +23,25 @@ void setup() { | |||
| 23 | 23 | ||
| 24 | 24 | void draw() { | |
| 25 | 25 | if (signal > img.height-1 || signal < 0) { | |
| 26 | - direction = direction * -1; | ||
| 26 | + direction = direction * -1; | ||
| 27 | 27 | } | |
| 28 | - if (mousePressed) { | ||
| 28 | + if (mousePressed == true) { | ||
| 29 | 29 | signal = abs(mouseY % img.height); | |
| 30 | - } else { | ||
| 31 | - signal += (0.3*direction); | ||
| 30 | + } | ||
| 31 | + else { | ||
| 32 | + signal += (0.3*direction); | ||
| 32 | 33 | } | |
| 33 | 34 | ||
| 34 | - if (keyPressed) { | ||
| 35 | + if (keyPressed == true) { | ||
| 35 | 36 | set(0, 0, img); | |
| 36 | 37 | line(0, signal, img.width, signal); | |
| 37 | - } else { | ||
| 38 | + } | ||
| 39 | + else { | ||
| 38 | 40 | int signalOffset = int(signal)*img.width; | |
| 39 | 41 | for (int y = 0; y < img.height; y++) { | |
| 40 | 42 | arrayCopy(img.pixels, signalOffset, pixels, y*width, img.width); | |
| 41 | 43 | } | |
| 42 | 44 | updatePixels(); | |
| 43 | 45 | } | |
| 44 | 46 | } | |
| 47 | + | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments