Fade with mousex
This is because the rectangle being drawn is black, hence the 0 value, and has an alpha transparency of 4. Try testing out the variables and make sure you understand what is happening: This way, in every FRAME the background will closer and closer the the full opacity and color of the box being drawn.īelow is the code. To do that, we will do something similar to what is happening with Method 2 above, except that we will be drawing a semi-transparent box in the draw() function. There have been some questions about creating FADES, so objects in the screen fade away after the shapes are drawn. The ONLY difference between these two programs (at least as far as coding goes) is that the first one defines the background() in the setup() function, and the second one does it in the draw() function.Ĭheck out the difference for yourself in the Processing program. The still image below doesn't show this very well, but simply imagine that a clean slate of black is drawn at the beginning of each frame The difference is that on each frame the background redraws and wipes out the old shapes. Now lets compare that with method two.an ANIMATED or moving shape.
The FIRST is what we did in tutorial one - repeatedly drawing a shape where we see its previously drawn frame, as we additively draw over it. Let's start by comparing two different modes of drawing shapes.
#FADE WITH MOUSEX HOW TO#
How to move items AND how to use conditional statements Processing Tutorial 3 - Animation and Conditions