FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Programs
(Moderators: fry, REAS)
   fading images
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: fading images  (Read 369 times)
ichbinjens


fading images
« on: Nov 20th, 2003, 7:00am »

hi, i would like to fade an image from full alpha to zero alpha. please help or give suggestions as to how to create this effect.
 
mKoser

WWW Email
Re: fading images
« Reply #1 on: Nov 20th, 2003, 2:58pm »

somthing like..
 
Code:

// set the color and alpha of the image
tint(255, 255, 255, a);
 
// diaplaying the image
image(img, 0, 0);

 
by setting using the tint() command, you can control what color the image will be displayed in (say, you can overlay it with red if you like) and what alpha (0-255) it should be displayed in.
 
look at:
http://proce55ing.net/reference/tint_.html
 
+ mikkel
 

mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
ichbinjens


Re: fading images
« Reply #2 on: Nov 20th, 2003, 9:32pm »

Hi, thanks for the reply. I am interested in sequentially fading my image from full alpha to no alpha, I know there needs to be a variable to do this but am not sure how to define it.
 
vent

WWW
Re: fading images
« Reply #3 on: Nov 20th, 2003, 9:54pm »

Maybe this will help:
 
Code:

 
int myAlpha;
BImage img;
 
void setup(){
 
  size(200, 200);
  img = loadImage("myImage.jpg");
  myAlpha = 255;
}
 
void loop(){
 
  // if you don't understand what this line is doing
  // simply solve a couple iterations of it on paper
  // then you'll get it.
  myAlpha +=(0-myAlpha)*0.05;
 
  tint(255,255,255, myAlpha);
  image(img, 0, 0);
 
}
 
 

http://www.shapevent.com/
benelek

35160983516098 WWW Email
Re: fading images
« Reply #4 on: Nov 21st, 2003, 2:16pm »

same thing, but easier to understand intuitively...
 
Code:
myAlpha -= myAlpha*0.05;
 
Pages: 1 

« Previous topic | Next topic »