もう少し賢く書けそう。
こちら。
PImage img;
int R=200, G=200, B=200;
void setup() {
size( 800, 800 );
background( R, G, B );
//Thanks for Yume Yume Iro TOWN http://www.poipoi.com/yakko/cgi-bin/sb/log/eid1737.html
img = loadImage("siruetto20080205a.png");
stroke(255, 0.0);
noCursor();
}
void draw() {
background(R, G, B);
float x=mouseX-280;
float y=mouseY-500;
for (int i=0; i<10; i++) {
fill(R, G, B, 30);
noStroke();
rect(0, 0, width, height);
float xi=map(i, 0, 10, width/2, x);
float yi=map(i, 0, 10, height/2, y);
float f=map(i, 0, 10, 0.1, 1);
image(img, xi, yi, 560*f, 1000*f);
}
}
void mouseMoved() {
int a=int(random(1, 4));
int pm;
if (R+G+B<50) {
pm=1;
} else if (random(0, 1.0)<0.5) {
pm=-1;
} else {
pm=1;
}
if (a==1) {
if (R==200) {
R=199;
} else if (R==1) {
R=2;
} else {
R=R+pm;
}
}
if (a==2) {
if (G==200) {
G=199;
} else if (G==1) {
G=2;
} else {
G=G+pm;
}
}
if (a==3) {
if (B==200) {
B=199;
} else if (B==1) {
B=2;
} else {
B=B+pm;
}
}
}