mirror of
https://github.com/processing/processing4.git
synced 2026-01-29 11:21:06 +01:00
Examples for Beta updates
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user