how to fade pixels?
in
Programming Questions
•
2 years ago
I'm using this code based on the "pointellism" tutorial, which writes the image pixels to the screen wonderfully, but I'm wondering how to make the pixels fade away in the same way? any help would be appreciated.
- import fullscreen.*;
- import processing.video.*;
- FullScreen fs;
- PImage erin;
- void setup() {
- frameRate(60);
- size(800,800);
- fs = new FullScreen(this);
- fs.enter();
- noCursor();
- erin = loadImage("erin2.jpg");
- background(0);
- smooth();
- }
- void draw() {
- drawCells();
- }
- void drawCells() {
- int x = int(random(erin.width));
- int y = int(random(erin.height));
- int loc = x + y*erin.width;
- loadPixels();
- float r = red(erin.pixels[loc]);
- float g = green(erin.pixels[loc]);
- float b = blue(erin.pixels[loc]);
- noStroke();
- fill(r,g,b,100);
- ellipse(x,y,5,5);
- }
1