Eine zweite Version.
void setup(){ size(640,480); } void draw(){ background(255); /* line malen, aber erst die Hälfte berechnen...*/ stroke(280,0,140); drawHalfWay(10,130); drawHalfWay(10,140); drawHalfWay(10,150); drawHalfWay(10,160); drawHalfWay(10,170); drawHalfWay(10,180); drawHalfWay(10,190); drawHalfWay(10,200); // stroke(310,0,110); drawHalfWay(20,120); drawHalfWay(20,130); drawHalfWay(20,140); drawHalfWay(20,150); drawHalfWay(20,160); drawHalfWay(20,170); drawHalfWay(20,180); drawHalfWay(20,190); stroke(340,0,90); drawHalfWay(30,110); drawHalfWay(30,120); drawHalfWay(30,130); drawHalfWay(30,140); drawHalfWay(30,150); drawHalfWay(30,160); drawHalfWay(30,170); drawHalfWay(30,180); stroke(370,0,70); drawHalfWay(40,100); drawHalfWay(40,110); drawHalfWay(40,120); drawHalfWay(40,130); drawHalfWay(40,140); drawHalfWay(40,150); drawHalfWay(40,160); drawHalfWay(40,170); stroke(400,0,50); drawHalfWay(50,90); drawHalfWay(50,100); drawHalfWay(50,110); drawHalfWay(50,120); drawHalfWay(50,130); drawHalfWay(50,140); drawHalfWay(50,150); drawHalfWay(50,160); stroke(400,105,0); drawHalfWay(60,80); drawHalfWay(60,90); drawHalfWay(60,100); drawHalfWay(60,110); drawHalfWay(60,120); drawHalfWay(60,130); drawHalfWay(60,140); drawHalfWay(60,150); // stroke(370,130,0); drawHalfWay(70,90); drawHalfWay(70,100); drawHalfWay(70,110); drawHalfWay(70,120); drawHalfWay(70,130); drawHalfWay(70,140); drawHalfWay(70,150); drawHalfWay(70,160); stroke(350,155,0); drawHalfWay(80,80); drawHalfWay(80,90); drawHalfWay(80,100); drawHalfWay(80,110); drawHalfWay(80,120); drawHalfWay(80,130); drawHalfWay(80,140); drawHalfWay(80,150); stroke(320,180,0); drawHalfWay(90,70); drawHalfWay(90,80); drawHalfWay(90,90); drawHalfWay(90,100); drawHalfWay(90,110); drawHalfWay(90,120); drawHalfWay(90,130); drawHalfWay(90,140); stroke(300,200,0); drawHalfWay(100,60); drawHalfWay(100,70); drawHalfWay(100,80); drawHalfWay(100,90); drawHalfWay(100,100); drawHalfWay(100,110); drawHalfWay(100,120); drawHalfWay(100,130); stroke(290,215,0); drawHalfWay(110,50); drawHalfWay(110,60); drawHalfWay(110,70); drawHalfWay(110,80); drawHalfWay(110,90); drawHalfWay(110,100); drawHalfWay(110,110); drawHalfWay(110,120); stroke(280,230,0); drawHalfWay(120,40); drawHalfWay(120,50); drawHalfWay(120,60); drawHalfWay(120,70); drawHalfWay(120,80); drawHalfWay(120,90); drawHalfWay(120,100); drawHalfWay(120,110); stroke(250,260,0); drawHalfWay(130,30); drawHalfWay(130,40); drawHalfWay(130,50); drawHalfWay(130,60); drawHalfWay(130,70); drawHalfWay(130,80); drawHalfWay(130,90); drawHalfWay(130,100); stroke(230,280,0); drawHalfWay(140,20); drawHalfWay(140,30); drawHalfWay(140,40); drawHalfWay(140,50); drawHalfWay(140,60); drawHalfWay(140,70); drawHalfWay(140,80); drawHalfWay(140,90); // stroke(200,300,0); drawHalfWay(150,10); drawHalfWay(150,20); drawHalfWay(150,30); drawHalfWay(150,40); drawHalfWay(150,50); drawHalfWay(150,60); drawHalfWay(150,70); drawHalfWay(150,80); stroke(200,340,0); drawHalfWay(160,10); drawHalfWay(160,20); drawHalfWay(160,30); drawHalfWay(160,40); drawHalfWay(160,50); drawHalfWay(160,60); drawHalfWay(160,70); drawHalfWay(160,80); stroke(200,400,0); drawHalfWay(170,20); drawHalfWay(170,30); drawHalfWay(170,40); drawHalfWay(170,50); drawHalfWay(170,60); drawHalfWay(170,70); drawHalfWay(170,80); drawHalfWay(170,90); stroke(100,400,0); drawHalfWay(180,30); drawHalfWay(180,40); drawHalfWay(180,50); drawHalfWay(180,60); drawHalfWay(180,70); drawHalfWay(180,80); drawHalfWay(180,90); drawHalfWay(180,100); stroke(0,200,200); drawHalfWay(190,40); drawHalfWay(190,50); drawHalfWay(190,60); drawHalfWay(190,70); drawHalfWay(190,80); drawHalfWay(190,90); drawHalfWay(190,100); drawHalfWay(190,110); stroke(0,200,230); drawHalfWay(200,50); drawHalfWay(200,60); drawHalfWay(200,70); drawHalfWay(200,80); drawHalfWay(200,90); drawHalfWay(200,100); drawHalfWay(200,110); drawHalfWay(200,120); stroke(0,200,250); drawHalfWay(210,60); drawHalfWay(210,70); drawHalfWay(210,80); drawHalfWay(210,90); drawHalfWay(210,100); drawHalfWay(210,110); drawHalfWay(210,120); drawHalfWay(210,130); stroke(0,100,270); drawHalfWay(220,70); drawHalfWay(220,80); drawHalfWay(220,90); drawHalfWay(220,100); drawHalfWay(220,110); drawHalfWay(220,120); drawHalfWay(220,130); drawHalfWay(220,140); // stroke(100,0,300); drawHalfWay(230,80); drawHalfWay(230,90); drawHalfWay(230,100); drawHalfWay(230,110); drawHalfWay(230,120); drawHalfWay(230,130); drawHalfWay(230,140); drawHalfWay(230,150); // stroke(120,0,280); drawHalfWay(240,70); drawHalfWay(240,80); drawHalfWay(240,90); drawHalfWay(240,100); drawHalfWay(240,110); drawHalfWay(240,120); drawHalfWay(240,130); drawHalfWay(240,140); stroke(150,0,240); drawHalfWay(250,60); drawHalfWay(250,70); drawHalfWay(250,80); drawHalfWay(250,90); drawHalfWay(250,100); drawHalfWay(250,110); drawHalfWay(250,120); drawHalfWay(250,130); stroke(180,0,220); drawHalfWay(260,50); drawHalfWay(260,60); drawHalfWay(260,70); drawHalfWay(260,80); drawHalfWay(260,90); drawHalfWay(260,100); drawHalfWay(260,110); drawHalfWay(260,120); stroke(210,0,200); drawHalfWay(270,40); drawHalfWay(270,50); drawHalfWay(270,60); drawHalfWay(270,70); drawHalfWay(270,80); drawHalfWay(270,90); drawHalfWay(270,100); drawHalfWay(270,110); stroke(240,0,180); drawHalfWay(280,30); drawHalfWay(280,40); drawHalfWay(280,50); drawHalfWay(280,60); drawHalfWay(280,70); drawHalfWay(280,80); drawHalfWay(280,90); drawHalfWay(280,100); stroke(270,0,150); drawHalfWay(290,20); drawHalfWay(290,30); drawHalfWay(290,40); drawHalfWay(290,50); drawHalfWay(290,60); drawHalfWay(290,70); drawHalfWay(290,80); drawHalfWay(290,90); stroke(300,0,130); drawHalfWay(300,10); drawHalfWay(300,20); drawHalfWay(300,30); drawHalfWay(300,40); drawHalfWay(300,50); drawHalfWay(300,60); drawHalfWay(300,70); drawHalfWay(300,80); stroke(340,0,110); drawHalfWay(310,10); drawHalfWay(310,20); drawHalfWay(310,30); drawHalfWay(310,40); drawHalfWay(310,50); drawHalfWay(310,60); drawHalfWay(310,70); stroke(280,0,140); drawHalfWay(10,210); drawHalfWay(10,220); drawHalfWay(10,230); stroke(280,0,140); drawHalfWay(20,210); drawHalfWay(20,220); stroke(280,0,140); drawHalfWay(30,210); stroke(280,0,140); drawHalfWay(40,130); drawHalfWay(40,140); drawHalfWay(40,150); drawHalfWay(40,160); drawHalfWay(40,170); drawHalfWay(40,180); drawHalfWay(40,190); drawHalfWay(40,200); } void drawHalfWay(int theX, int theY){ int myHalfX = getAverage(mouseX, theX); int myHalfY = getAverage(mouseY, theY); line(theX, theY, myHalfX, myHalfY); } int getAverage(int theA, int theB){ int myHalfWay = ((theA + theB) / 2); return myHalfWay; }