Fading

You can also use variables to control transparency. With the fill() command, you can add a 4th parameter for opacity (alpha). Like the Red, Green, and Blue values, the Alpha value goes from 0 to 255.
int opacity=0; void setup() { size(500,300); background(0); } void draw() { background(0); // draw a blue circle fill(0,0,255); ellipse(250,100,150,150); // draw red circle over it opacity++; if (opacity>255) { opacity=0; } fill(255,0,0,opacity); ellipse(250,200,150,150); }