Advertisement
Nojus_Globys

1 | dot's-path

Oct 24th, 2022 (edited)
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. int step = 30;
  2. float x, y;
  3.  
  4. void setup() {
  5.     size(1280, 747);
  6.     background(0);
  7.     fill(255);     //fill(0, 80);
  8.     noStroke();
  9.     y = x = width/2;
  10. }
  11.  
  12. void draw() {
  13.     circle(x, y, 5);
  14.     x += random(-step, step);
  15.     y += random(-step, step);
  16.     //println (x, '\t', y);
  17.     if (x < 0)
  18.         x = 0;
  19.     if (y < 0)
  20.         y = 0;
  21.     if (x > width)
  22.         x = width;
  23.     if (y > height)
  24.         y = height;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement