xxxxxxxxxx
float r0 = 100;
boolean boo = false;
float deg;
int nKey = 100;
void setup() {
size(900, 900);
background(0);
}
void draw() {
fill(0, 20);
noStroke();
rect(0, 0, width, height);
//stroke(255, 100);
float oriX = 0.5*width;
float oriY = 0.5*height;
int yMax = (int)map(mouseY, 0, height, 0, 51);
float xPow = (float)map(mouseX, 0, width, 0, 1.25);
for (int i=0; i<yMax; i++) {
float r = r0*(2-pow(xPow, -i));
float mDeg = (float)map(i, 0, yMax, 0, nKey);
deg = 2*PI/mDeg;
float dia = map(r, r0*(2-pow(xPow, 0)), 100*(2-pow(xPow, -yMax)), 100, 0);
for (float a=deg; a<2*PI+deg; a+=deg) {
if (boo) {
noFill();
//strokeWeight(0.1);
stroke(255, 50);
ellipse(oriX+r*sin(a), oriY+r*cos(a), dia, dia);
} else {
strokeWeight(1);
stroke(255, 100);
point(oriX+r*sin(a), oriY+r*cos(a));
}
}
}
//println(mouseY);
}
void mousePressed() {
boo = !boo;
//if (mouseButton == RIGHT) {
// boo = !boo;
//} else {
// saveFrame("frames/frames-###.png");
//}
}
void keyPressed() {
if (key=='1') {
strokeWeight(0.1);
nKey = 100;
} else if (key=='2') {
strokeWeight(0.2);
nKey = 30;
} else if (key=='3') {
strokeWeight(0.5);
nKey = 20;
} else if (key=='4') {
strokeWeight(0.8);
nKey = 10;
} else if (key=='5') {
strokeWeight(1);
nKey = 5;
}
}