Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void setup()
- {
- size(512, 512);
- }
- public void draw()
- {
- background(255);
- int numberOfPoints = 10 + (mouseX * 2) - 1;
- float fromAngle = 0;
- float toAngle = TWO_PI;
- float radius1 = 200.0f;
- float radius2 = 100.0f;
- fill(0);
- noStroke();
- beginShape();
- for (int i = 0 ; i < numberOfPoints ; i++)
- {
- float p = i / (numberOfPoints - 1.0f);
- float cA = lerp(fromAngle, toAngle, p);
- float radius;
- if (i % 2 == 0)
- {
- radius = radius1;
- }
- else
- {
- radius = radius2;
- }
- vertex(
- width / 2.0f + cos(cA) * radius,
- height / 2.0f + sin(cA) * radius
- );
- }
- endShape();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement