int r = 1; int a = 0; int b = 0; float i = 0; float lx, ly, lx2, ly2; float x, y, x2, y2; float t; void setup() { size(400,400); background(0); stroke(255,70); drawShape(a,b); } void draw() { if(mousePressed) { background(0); i = 0; a = mouseX/7; b = mouseY/7; drawShape(a,b); } } void drawShape(int a, int b) { translate(width/2,height/2); rotate(PI/2); for(int i = 0; i<360; i++) { 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); curve(x,y,lx,ly,lx2,ly2,x2,y2); 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); } }