Examples for Beta updates

This commit is contained in:
Casey Reas
2012-09-01 15:38:03 +00:00
parent b61f3c26b6
commit 98e8349666
2 changed files with 10 additions and 7 deletions

View File

@@ -6,7 +6,7 @@
*/
// The next line is needed if running in JavaScript Mode with Processing.js
/* @pjs preload="sea.jpg"; */
/* @pjs preload="sea.jpg"; */
PImage img;
int direction = 1;
@@ -23,18 +23,20 @@ void setup() {
void draw() {
if (signal > img.height-1 || signal < 0) {
direction = direction * -1;
direction = direction * -1;
}
if (mousePressed) {
if (mousePressed == true) {
signal = abs(mouseY % img.height);
} else {
signal += (0.3*direction);
}
else {
signal += (0.3*direction);
}
if (keyPressed) {
if (keyPressed == true) {
set(0, 0, img);
line(0, signal, img.width, signal);
} else {
}
else {
int signalOffset = int(signal)*img.width;
for (int y = 0; y < img.height; y++) {
arrayCopy(img.pixels, signalOffset, pixels, y*width, img.width);
@@ -42,3 +44,4 @@ void draw() {
updatePixels();
}
}