class Flocke // Klassendefinition { float radius; // Radius Variable float xPos; // Position in X float yPos; // Position in X float velY; // Geschwindigkeit in Y color col = color(255); // Flocken-Farbe Flocke(float r, float xp , float vy) { radius = r; // Wertźbergabe von lokalen xPos = xp; // zu globalen Variablen yPos = (-1*random(100)); // źbergeben aus Instanzierung velY = vy; // Fall-Geschwindigkeit } void fall() { draw(); int links = int(random(2)); if (links==1) { xPos -= random(2); // Berechnung der neuen X Position } else { xPos += random(2); // Berechnung der neuen X Position } if (yPos> random(500,600)) { yPos = (-1*random(100)); } else { yPos += velY; // Berechnung der neuen Y Position } } void draw() // Zeichenmethode { ellipseMode(CENTER); // setzt Kreismittelpunkt fill(col); stroke(255); quad(xPos-random(radius), yPos-random(radius), xPos+random(radius), yPos-random(radius), xPos+random(radius), yPos+random(radius), xPos-random(radius), yPos+random(radius)); //ellipse(xPos,yPos,radius*2,radius*2); // zeichne Ellipse } } //------------------------------------------------------------------ int flockennumber = 600; Flocke[] myFlocken = new Flocke[flockennumber]; // Definition Ball Array void setup() // Initialisierung des Programms { size(500,500); // Definition Applet Gršsse frameRate(45); for(int i = 0; i < flockennumber; i++) { myFlocken[i] = new Flocke(random(1,7),random(500),random(5)); } } void draw() // Wird an jeder Frame aufgerufen { background(0); // Zeichne Hintergrund for(int i = 0; i