home/ atoms/ processing-motion-blur-technique

Drawing a semi-transparent black rectangle each frame creates a motion trail by gradual fade

Instead of calling background() to clear the canvas each frame, drawing a semi-transparent black rectangle (fill(0, alpha)) partially erases previous content. Each frame adds a slight fade layer, so older marks appear increasingly dark. The alpha value controls decay speed: high alpha (near 255) erases quickly (near-instant clear); low alpha (near 0) creates a long trail. This is a simple approximation of motion blur or persistence-of-vision effects and is cheaper than full framebuffer blending.

Examples

void draw() { fill(0, 15); // semi-transparent black rect(0, 0, width, height); fill(255); ellipse(x, y, 20, 20); }

Assessment

Predict the visual difference between alpha=10 and alpha=200 in the fade rectangle; explain why this technique cannot produce the same result as a true background() call.

“You can create motion blur by drawing a transparent rectangle within draw(). This is an alternative to running background() at the beginning of draw() and can produce a subtle fade rather than a complete refresh.”
corpus · processing-handbook-no-login-mirror-pdf-reas-and-fry · chunk 60