Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PVector[] points = new PVector[4];
- float x, y, destx, desty, r;
- int i=0;
- void setup() {
- size(1000, 1000);
- background(#202020);
- noStroke();
- int edge = 350;
- rectMode(CENTER);
- points[0] = new PVector(edge, edge);
- points[1] = new PVector(width-edge, edge);
- points[2] = new PVector(width-edge, height-edge);
- points[3] = new PVector(edge, height-edge);
- x = points[0].x;
- y = points[0].y;
- destx = points[0].x;
- desty = points[0].y;
- }
- void draw() {
- stroke(255, 200);
- float sz = map(sin(r), -1, 1, width/10, width/3);
- float v = 10;
- x = lerp(x, destx, 0.1);
- y = lerp(y, desty, 0.1);
- float d = dist(x, y, destx, desty);
- if (d < 1) {
- x = destx;
- y = desty;
- i++;
- //if (i==5) noLoop();
- destx = points[i%4].x;
- desty = points[i%4].y;
- }
- pushMatrix();
- translate(x, y);
- rotate(r);
- if (random(1)>.7) {
- fill(#DAD782, 100);
- } else {
- fill(#BA3088, 150);
- }
- rect(-20+random(-v, v), +20+random(-v, v), sz, sz, sz/10);
- popMatrix();
- r += 0.0523*2;
- }
- void keyPressed() {
- save(random(2323)+".png");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement