Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float px, py;
- float v1x, v2x, v3x;
- float v1y, v2y, v3y;
- void setup() {
- fullScreen();
- background(0);
- v1x = width/2;
- v2x = width/6;
- v3x = 5*width/6;
- v1y = 50;
- v2y = v3y = height-50;
- fill(125, 255, 0);
- ellipse(v1x, v1y, 5, 5);
- ellipse(v2x, v2y, 5, 5);
- ellipse(v3x, v3y, 5, 5);
- px = v1x;
- py = v1y;
- }
- void draw() {
- float tempvx, tempvy;
- for(int i = 0; i < 50; ++i) {
- int v = (int)random(3) + 1;
- switch(v) {
- case 1: tempvx = v1x; tempvy = v1y; break;
- case 2: tempvx = v2x; tempvy = v2y; break;
- default: tempvx = v3x; tempvy = v3y;
- }
- px = (px + tempvx)/2;
- py = (py + tempvy)/2;
- ellipse(px, py, 5, 5);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement