Ah, a little morning challenge! I hope this is not homework...
Just in case, I give only the start of a possible solution. This evening, I will show the final solution. I invite you to try a solution of your own in the meanwhile (if you are not in the middle of the night on your side...).
Draw a simple circle:
- void setup()
- {
- size(500, 500);
- smooth();
- background(255);
-
- float cx = width / 2;
- float cy = height / 2;
- float radius = 0.75 * width / 2;
- float px = 0, py = 0;
- for (int angle = -1; angle <= 360; angle++)
- {
- float a = radians(angle);
- float x = cx + radius * cos(a);
- float y = cy + radius * sin(a);
- if (angle >= 0)
- {
- line(px, py, x, y);
- }
- px = x;
- py = y;
- }
- }
You can use smaller steps too.
Hint: use a disturbance of the radius, varying it with a trigonometric function.