If you wanted to write a program in java that uses a JFrame to simulate the falling green code from the matrix movie using ascii string characters so it looks exactly like this php example
http://mgccl.com/2007/03/30/simple-version-matrix-like-animated-dropping-character-effect-in-php
what would be the best way of doing it? labels, drawString? etc...
I know that within a for-loop for example you could use the integer value i to decrease the y-axis values, darken the color setColor(new Color(255, 255 - (i * 5), 255));
but i don't know how you would leave the "imprint" behind.
thanks
This example shows how to fade text using alpha transparency, while this example illustrates how to fade text by varying the color saturation.
Addendum:
I'd solve the problem in a single, columnar
JPanel
that is as wide as the chosenFont
and arbitrarily tall. Use ajavax.swing.Timer
to control animation. Then use anew GridLaylout(1, 0)
to contain any number of such columns as a single row.Once you reach 0 for i, you just start doing to same for two other channels so it will gradually turn black or disappear.
The length depends on the step size (which is 5 in your case and thus the length of the imprint is 51). So if you want short imprint, you have to do
numSteps = 255 / length
of the imprint (rounding issue should not be ignored):