Hi, I'm sure I'm doing something wrong but......
I'm trying to fade a sketch to black over time, something that I thought would be a relatively painless process. I have the following code:
Quote:int x=0;
void setup() {
size(300,300);
colorMode(RGB);
background(0,0,0);
smooth();
}
void draw() {
fill(0,0,0,2);
noStroke();
rect(0, 0, 300, 300);
x++;
if(x>300) { x=0; }
stroke(255,255,255);
line( x,0,x,300);
}
I thought that the line that's drawn would slowly fade to black? Or have I missed something? While this does fade the line out, it doesn't fade all the way to black. Using higher values (15 for example) as the alpha parameter to fill() works as I would expect. I've tried passing a "color" variable (e.g. color c=#000000) to the fill function but it gives the same result.
I've searched this board for similar issues and found this...
http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1083650609
...but I'm not sure if its exactly the same problem and to be honest the end of the discussion goes over my head a bit! One of the replies (from mKoser) offers a solution (using the pixels[] array) which does work, but it's incredibly slow!
Have I missed something?