We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Fading out some elements and not others
Page Index Toggle Pages: 1
Fading out some elements and not others (Read 508 times)
Fading out some elements and not others
Feb 3rd, 2006, 10:20pm
 
I'm trying to write a patch with the following behavior:

Graphics are drawn and slowly fade over time in the foreground, while a video plays in the background.

My demo processing app currently implements the fading behavior by not clearing the PApplet's display with a background() at the beginning of each draw() but instead doing fill(0,0,0,50); rect(800,600); .. this works great so long as the background is black but the moment you start drawing video frames in there, bad things happen..

One solution is to keep a list of the previous n frame's lines, and then adjust their fill opacity so the older ones are less opaque until they go transparent and then are removed from the list..

The other would be to have more than one PGraphics going, and fade the one with the line graphics to transparent rather than black, then paint it on a rect() over top of the rect() containing the video..

Which of these solutions seems easier to implement? I know how to implement the first setup, but it's a pain in the ass, especially if I decide to change how the graphics look.. I'd really rather run with the second app, but I'm not sure how to do subtractive rather than additive transparency.. (can I fill(0,0,0,-50);? Cause that would be nice)
Page Index Toggle Pages: 1