Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int x1, y1, x2, y2, x3, y3;//set dots
- int randX, randY;//random dot
- int xLast, yLast;
- void setup()
- {
- size(800, 800);
- background(#F5ECCF);
- noStroke();
- x1 = 250;
- y1 = 250;
- x2 = 250;
- y2 = 550;
- x3 = 550;
- y3 = 50;
- randX = (int)random(100)+350;
- randY = (int)random(100)+350;
- xLast = randX;
- yLast = randY;
- //color 1
- fill(#F26530);
- ellipse(x1, y1, 5, 5);
- //color 2
- fill(#71A235);
- ellipse(x2, y2, 5, 5);
- //color 3
- fill(#27BDB2);
- ellipse(x3, y3, 5, 5);
- fill(0);
- ellipse(randX, randY, 5, 5);
- frameRate(700);
- }
- void draw()
- {
- int roondy = (int)random(4);
- if (roondy == 1) //color 1
- {
- fill(#F26530);
- xLast = (x1 + xLast)/2;
- yLast = (y1+yLast)/2;
- ellipse(xLast, yLast, 5, 5);
- } else if (roondy == 2) //color 2
- {
- fill(#71A235);
- xLast = (x2 + xLast)/2;
- yLast = (y2+yLast)/2;
- ellipse(xLast, yLast, 5, 5);
- } else
- {
- fill(#27BDB2);
- xLast = (x3 + xLast)/2;
- yLast = (y3+yLast)/2;
- ellipse(xLast, yLast, 5, 5);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement