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)
   problem with alpha
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: problem with alpha  (Read 310 times)
paul

WWW Email
problem with alpha
« on: Oct 17th, 2003, 8:38pm »

hi all,
i just want a white line, on a black background to go from top to the bottom of my window. if i press the mouseButton, the lines previousley drawn, should fade out.
i draw a black rect in the beginning of every frame with a alphaValue of 255 and while the mouse is pressed 100.
but if i press the mousebutton all lines are white - like the alphavalue is 0.
what do i do wrong?
would be nice if somebody could help me...
thx, paul
 
i'm using rev065 on osX. here is my code:
 
int numberOfLines;
int count;
float dist;
int alphaValue;
 
void setup()
{
  size(200,200);
  background(0);
  numberOfLines = 40;
  dist = height / numberOfLines;
  count = 0;
  alphaValue = 255;
}
 
void loop()
{
  fill(0,0,0,alphaValue);
  rect(0,0,width,height);
 
  if (mousePressed == true)  
  {
    alphaValue = 100;
  }
  else  
  {
    alphaValue = 255;
  }
  stroke(255);
  int y = count % numberOfLines;
  line(0, y*dist, width, y*dist);
  count++;
}
 
Pages: 1 

« Previous topic | Next topic »