boolean bPlay = false; float interations = 4; int r = 1; int a = 0; int b = 0; float i = 0; float lx = 0, ly = 0, lx2 = 0, ly2 = 0; float x = 0, y = 0, x2 = 0, y2 = 0; float t; void setup() { size(400,400); background(0); stroke(255,40); drawShape(a,b); } void draw() { background(0); drawShape(a,b); } void mousePressed() { background(0); stroke(255,40); lx = ly = lx2 = ly2 = 0; x = y = x2 = y2 = 0; //i = 0; //interations = 4; a = mouseX/7-(width/2); b = mouseY/7-(height/2); } void keyPressed() { if(key=='+') { background(0); interations-=1; if(interations==0) interations=360; } if(key=='-') { background(0); interations+=1; if(interations==361) interations=1; } } void drawShape(int a, int b) { translate(width/2,height/2); rotate(PI/2); for(int i = 0; i<360; i+=interations) { t = i*PI/180; lx = r*cos(a*t)*(width/3); ly = r*sin(b*t)*(height/3); x = r*cos(t)*(width/3); y = r*sin(t)*(height/3); bezier(lx,ly,x2,y2,x,y,lx2,ly2); bezier(-lx,-ly,x2,y2,-x,-y,lx2,ly2); //ellipse(lx,ly,3,3); //ellipse(lx2,ly2,3,3); lx2 = r*cos(a*t)*(width/3); ly2 = r*sin(b*t)*(height/3); x2 = r*cos(t)*(width/3); y2 = r*sin(t)*(height/3); } rotate(-PI/2); translate(-width/2,-height/2); }