This is a Processing sketch inspired by the Coding Train’s Coding Challenge #4 on creating an homage to Prince’s Purple Rain.

After reading Prince’s explanation of the song: (via NME.com)

“When there’s blood in the sky – red and blue = purple … purple rain pertains to the end of the world and being with the one you love and letting your faith/god guide you through the purple rain.”

I decided to make a simple PurpleGenerator:

  color generatePurple(){
    return color(50 + random(200), 30, 50 + random(200));

And have background drawn with an alpha setting of 40 (out of 255), to create a fading effect:

void draw(){
  fill(color(100, 100, 120, 40));
  rect(0, 0, width, height);



  • Click + Drag … generates the new rain drops that location.