/**
an aquarium by guru
and mona
*/
PImage fish;
PImage p1,p2,p3,p4;
int pos = 300;
int dir = -3;
void setup() {
size(300,300);
fish = loadImage( "mini_fish.png" );
p1 = loadImage("wasserpflanze1.png");
p2 = loadImage("wasserpflanze2.png");
p3 = loadImage("wasserpflanze3.png");
p4 = loadImage("wasserpflanze4.png");
frameRate(25);
}
void draw() {
background(200,200,255);
image(p1,250,height - p1.height );
image(p2,90,height - p2.height );
float h = 150 + sin(float(frameCount)/10) * 30;
if (dir < 0) {
image(fish, pos,h,100,70);
} else {
pushMatrix();
scale(-1,1);
image(fish, -fish.width-pos,h,100,70);
popMatrix();
}
image(p3,20,height - p3.height );
image(p4,170,height - p4.height );
pos+=dir;
if (pos <= -fish.width) {
dir = dir * -1;
}
if (pos >= width) {
dir = dir * -1;
}
}