Advertisement
TeslaCoilGirl

TV Static Code

Jun 25th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. void setup() {
  2.   size(600,600);
  3.   background(#ffffff);
  4. }
  5.  
  6. void draw() {
  7.   background(#000000);
  8.   staticDots(1, 5, 255, 0, 0, 0, 200, 0, 600, 10);
  9.   staticDots(1, 5, 0, 255, 0, 200, 400, 0, 600, 20);
  10.   staticDots(1, 5, 0, 0, 255, 400, 600, 0, 600, 30);
  11. }
  12.  
  13. // Creates TV Static Effect.
  14. // Arguments in order: Stroke min and max weight, RGB color, XY bounds,
  15. // and density of static.
  16. void staticDots(int strokeMin, int strokeMax, int r, int g, int b, int xmin, int xmax, int ymin, int ymax, int density) {
  17.    int dotCount = 0;
  18.   while (dotCount <= density) {
  19.     strokeWeight(random(strokeMin, strokeMax));
  20.     stroke(r,g,b);
  21.     point(random(xmin,xmax), random(ymin,ymax));
  22.     dotCount++;
  23.   }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement