mirror of
https://github.com/dyne/FreeJ.git
synced 2026-06-16 12:59:33 +02:00
progresses on processing script
processing-js 0.4 has been merged in some relevant parts basic and topic scripts added for test color handling fixed, more scripts show up now
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
PImage a;
|
||||
int[] aPixels;
|
||||
int direction = 1;
|
||||
boolean onetime = true;
|
||||
float signal;
|
||||
|
||||
void setup()
|
||||
{
|
||||
size(200, 200);
|
||||
aPixels = new int[width*height];
|
||||
noFill();
|
||||
stroke(255);
|
||||
frameRate(30);
|
||||
a = loadImage("data/ystone08.jpg", null, function(){
|
||||
for(int i=0; i<width*height; i++) {
|
||||
aPixels[i] = a.pixels[i];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
if (signal > width*height-1 || signal < 0) {
|
||||
direction = direction * -1;
|
||||
}
|
||||
|
||||
if(mousePressed) {
|
||||
if(mouseY > height-1) { mouseY = height-1; }
|
||||
if(mouseY < 0) { mouseY = 0; }
|
||||
signal = mouseY*width+mouseX;
|
||||
} else {
|
||||
signal += (0.33*direction);
|
||||
}
|
||||
|
||||
if(keyPressed) {
|
||||
image(a, 0, 0);
|
||||
/*
|
||||
loadPixels();
|
||||
for (int i=0; i<width*height; i++) {
|
||||
pixels[i] = aPixels[i];
|
||||
}
|
||||
updatePixels();
|
||||
*/
|
||||
rect(signal%width-5, int(signal/width)-5, 10, 10);
|
||||
point(signal%width, int(signal/width));
|
||||
} else {
|
||||
background( aPixels[int(signal)] );
|
||||
/*
|
||||
loadPixels();
|
||||
for (int i=0; i<width*height; i++) {
|
||||
pixels[i] = aPixels[int(signal)];
|
||||
}
|
||||
updatePixels();
|
||||
*/
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user