Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : mousePressed + Fade In + Fade Out

$
0
0
I would try something like this:

(You need to be online for image to load.)

  1. PImage standForVideo;
  2. int alphaVal = 255;


  3. void setup() {
  4.   size(500, 332);
  5.   standForVideo = loadImage("http://www.hightech-edge.com/wp-content/uploads/chad-estes-slow-shutter-shots.jpg");
  6.   noStroke();
  7. }

  8. void draw() {
  9.   image (standForVideo, 0, 0);
  10.   if (!mousePressed && alphaVal < 255) {
  11.     alphaVal ++;
  12.   }
  13.   else if (mousePressed && alphaVal > 0) {
  14.     alphaVal--;
  15.   }
  16.   fill(0, 30, 150, alphaVal);
  17.   rect(0, 0, width, height);
  18.   println(alphaVal);
  19. }


Viewing all articles
Browse latest Browse all 1768

Trending Articles