/** * Mausfolgen * * Die Maus malt eine orange Linie, die langsam verblasst. * muß wirklich noch verbessert werden */ int x0,y0,x1,y1,x2,y2; boolean maus; boolean anfang=true; boolean stop=false; int fill1=0 , fill2=3; int hinter=42; void setup() { size(600, 200); fill(fill1,fill2); stroke( 255, 223, 72); background(hinter); smooth(); strokeWeight(6); frameRate(20); } void draw() { if (!stop) { if (maus) { x2=mouseX; y2=mouseY; curve( x0,y0, x1,y1, x2,y2, x2,y2 ); x0=x1; y0=y1; x1 = x2; y1 = y2; maus = false; } // if maus rect(-4, -4, width+7, height+7); } // if !stop } void mouseMoved() { if ( abs(x2-mouseX)+abs(y2-mouseY)>2 ) { maus = true; } if (anfang) { x2=mouseX; y2=mouseY; x1 = x2; y1 = y2; x0=x1; y0=y1; anfang = false; } // if anfang } // mausMoved void mouseReleased() { if (mouseButton == LEFT) { fill(hinter,255); rect(-4, -4, width+7, height+7); fill(fill1,fill2); anfang = true; stop = false; x2=mouseX; y2=mouseY; x1 = x2; y1 = y2; x0=x1; y0=y1; } else { stop = true; } }