home/ atoms/ alpha-transparency-layering

Drawing with semi-transparent fill and no background clear lets shapes accumulate as a trace

In Processing, fill() and stroke() accept a fourth argument for alpha (0=invisible, 255=opaque). When background() is not called in draw(), each new frame is painted on top of the previous one — shapes with low alpha accumulate gradually, creating a trail or layering effect. Conversely, calling background() each frame clears the canvas and shows only the current state. The ‘leaving traces’ technique suppresses the clear and uses low-alpha fills (e.g. fill(255, 10)) so that the sketch records its own history visually. This is a key creative tool for generative art because the accumulation of many semi-transparent shapes produces rich tonal gradients without explicit colour mixing code.

Examples

ch2_4_2_LeavingTracesv01.pde: the background(30) call is commented out inside draw(), and fill is set to fill(255, 10). Each frame adds a slightly-opaque circle, building up concentric rings over time. ch2_4_2_LeavingTracesv02.pde varies increment size for different density patterns.

Assessment

Compare ch2_3_1_FrameLoop.pde (which calls background() each frame) with ch2_4_2_LeavingTracesv01.pde (which does not). Describe the visual difference and explain which alpha value would make accumulation fastest.

“//background(245); ellipse(centX, centY, diam”
corpus · generative-art-code-examples-josephfiola-genart-processing-p · chunk 17
“int diam = 40; int diamIncrement = diam*2;”
corpus · generative-art-code-examples-josephfiola-genart-processing-p · chunk 18