Februar 27, 2012
![](../../../../files/2012/02/ProcessingLogo.png)
![](../../../../files/2012/02/Auto.gif)
bild bild1; bild bild2; bild bild3; bild bild4; bild bild5; int c = 1; boolean forward = true; void setup() { size(1920,1200); bild1 = new bild("megusta.png",200,4,100,100); bild2 = new bild("megusta.png",150,2,50,50); bild3 = new bild("megusta.png",300,1,700,700); bild4 = new bild("megusta.png",350,1.5,60,60); bild5 = new bild("megusta.png",500,3,900,900); } void draw() { background(23,150,c); if (forward) { c+=5; } else { c-=5; } if (c >= 255) { forward = false; } else if (c <= 0) { forward = true; } bild1.display(); bild1.drive(); bild2.display(); bild2.drive(); bild3.display(); bild3.drive(); bild4.display(); bild4.drive(); bild5.display(); bild5.drive(); }Klasse Bild:
class bild { PImage myImage; float xPos; float xSpeed; float h; float b; bild(String _myImage, float _xPos, float _xSpeed, float _h, float _b) { myImage = loadImage(_myImage); xPos = _xPos; xSpeed = _xSpeed; h = _h; b = _b; } void display() { image(myImage,xPos,0,h,b); } void drive() { xPos = xPos+ random(-45,55); if (xPos>width) { xPos=0; } } }
![](../../../../files/2012/02/gusta-300x180.png)