Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup() {
- size(600,600);
- background(#ffffff);
- }
- void draw() {
- background(#000000);
- staticDots(1, 5, 255, 0, 0, 0, 200, 0, 600, 10);
- staticDots(1, 5, 0, 255, 0, 200, 400, 0, 600, 20);
- staticDots(1, 5, 0, 0, 255, 400, 600, 0, 600, 30);
- }
- // Creates TV Static Effect.
- // Arguments in order: Stroke min and max weight, RGB color, XY bounds,
- // and density of static.
- void staticDots(int strokeMin, int strokeMax, int r, int g, int b, int xmin, int xmax, int ymin, int ymax, int density) {
- int dotCount = 0;
- while (dotCount <= density) {
- strokeWeight(random(strokeMin, strokeMax));
- stroke(r,g,b);
- point(random(xmin,xmax), random(ymin,ymax));
- dotCount++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement