float[] a1 = new float[2]; float[] a2 = new float[2]; float[] c1 = new float[2]; float[] c2 = new float[2]; PFont font; String[] msgs = new String[4]; int turn =0; void setup() { size(800,600); background(255); font = createFont("Ariel",20); textFont(font); msgs[0] ="Click to set anchor 1"; msgs[1] ="Click to set anchor 2"; msgs[2] = "Click to set control 1"; msgs[3] = "Click to set control 2"; fill(0,0,250); text(msgs[0],10,20); } void draw() { } void mousePressed() { //background(255); stroke(0,255,0); triangle(mouseX,mouseY, mouseX, mouseY+3,mouseX+3,mouseY); switch(turn) { case 0: a1[0] = mouseX; a1[1] = mouseY; break; case 1: a2[0] = mouseX; a2[1] = mouseY; break; case 2: c1[0] = mouseX; c1[1] = mouseY; break; case 3: c2[0] = mouseX; c2[1] = mouseY; break; } turn++; if (turn<4) { //erasing old message fill(255); noStroke(); rect(5,3,200,30); fill(0,0,250); text(msgs[turn],10,20); } else { turn=0; //erasing old message fill(255); noStroke(); rect(5,3,200,30); fill(0,0,250); fill(0,0,250); bezier(a1[0],a1[1],c1[0],c1[1],c2[0],c2[1],a2[0],a2[1]); text(msgs[0],10,20); } }