Learn creative coding writing simple programs

22. Stars blinking at night (fade out effect)

In this episode we create an interesting fade out effect. Until now, every time we animated (moved) something on the screen, we erased the whole display before drawing each new frame. But instead of using background() to erase the whole screen, we can draw a rectangle that covers every pixel. The trick is to use a low opacity. This means that the "paint" we use does not complete cover the old drawing. It's like a tinted car window or our sunglasses. So on each frame we add a new black layer that makes things a little bit darker. Then draw something new on top, in this case small circles. The result is quite interesting. You can try this for any previous animation we have made. Just replace the first call to background() inside the draw() function with two lines: fill(0, 10); and rect(0,0,width,height);

Tags:

Code editor

You can make changes to the code below. Then
Below you can ask and answer questions related to this video. If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)
comments powered by Disqus