Click to draw statics on stage
Click on stage to draw static geometry.
void setup() { size(400, 400); background(255); } void draw() { if (mousePressed){ //parsen der funktion random mit (int) zu einer Integer Zahl //tropfen(mouseX, mouseY, (int)random(20)); //funktion floor rundet eine float zahl auf eine ganzZahl ab int randomGroesse = floor( random(20) ); //zeichnet einen tropfen an der Mouseposition tropfen(mouseX, mouseY, randomGroesse); } } void tropfen(float theX, float theY, int groesse){ //neue Matrix eröffnen pushMatrix(); //springen zum Anfangspunkt translate(theX, theY); //rotieren damit der Tropfen gerade ist rotate( radians(45) ); //Koordinaten für tropfen zeichnung int coord = 0; // X- und Y-Koordinate //wiedeholt solange bis s gleichgroß der übergebenen groesse wird for(int s=0; s<groesse; s++){ //strichstärke wächst bei jeder schleife abhängig zu s strokeWeight(s); //setzt einen punkt an den koordinaten coord / coord point(coord, coord); //setzt coord einen höher coord++; } //schliessen der matrix popMatrix(); }