This here is a very simple technique, that may be CPU-extensive, but very easy to code. If you ever wanted to do something like a “worm” or “fade” effect, than the most clean way to achieve this is by using array-techniques, that is a time-consuming and sometimes complicated task.

This here I tried something else, that makes the code very small, with a tiny little hack, that does a “worm/fade” effect, just by using the canvas. The thing is simple: you just draw a transparent rectangle in the color of the canvas over the scene, just right after every frame. Visually the “worm” takes place. See it in action!

processing-fadehack-zini.gif

This technique is not suitable for most situations. But for small sequences or just to quick-draw simple effects can benefit from this easy solution. Also feel free to expand and experiment with this technique. Apply it to everything and very interesting effects will be at hand.

The Fade Hack

Made in processing, but the hack can be applied to mostly everything.

  • Choose a backgroundcolor b
  • choose the matching color bt with added transparacy
  • draw a transparent rect over the whole screen at every draw
  • simply move your object

processing-fadehack-code.gif

Copy and paste code:

// The Fade Hack
// making a trail by a very simple technique
// This is processing code
// (cc) by Martin Wisniowski http://digitaltools.node3000.com

color b = color(0);
color bt = color(0,0,0,15);

void setup() {
size(450,300);
background(b);
framerate(30);
noStroke();
smooth();
noCursor();
}

void draw() {
// fade hack
fill(bt);
rect(0,0,width,height);

fill(250,250,0);
ellipse(mouseX,mouseY,50,50);
}
Download - Date published: November 23, 2005 | Comments Off

Readers left no comments, be the first one to do so!

Comments are closed.