Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float angle, radius, lx, ly, sz = 5;
- int num = 40;
- PVector[] dots = new PVector[num];
- PVector[] endPos = new PVector[num];
- void setup() {
- size(500, 500);
- background(20);
- fill(#FFA41A);
- stroke(#FFA41A);
- strokeWeight(10);
- strokeJoin(ROUND);
- radius = width*.4;
- startingPoints();
- for (int i=0; i<num; i++) {
- float px = width/2 + sin(angle)*radius;
- float py = height/2 + cos(angle)*radius;
- endPos[i]= new PVector(px, py);
- angle+=TWO_PI/num;
- }
- }
- void draw() {
- background(20);
- beginShape();
- for (int i=0; i<num; i++) {
- dots[i].x = lerp(dots[i].x, endPos[i].x, 0.02);
- dots[i].y = lerp(dots[i].y, endPos[i].y, 0.02);
- if (i==0) curveVertex(dots[i].x, dots[i].y);
- curveVertex(dots[i].x, dots[i].y);
- if (i==num-1) curveVertex(dots[i].x, dots[i].y);
- }
- endShape(CLOSE);
- if (frameCount%241==0) startingPoints();
- }
- void startingPoints() {
- for (int i=0; i<num; i++) {
- float x = random(width*.33, width*.66);
- float y = random(height*.33, height*.66);
- dots[i]= new PVector(x, y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement