beltoforion.de
 Contact |  CSS |  XHTML

A simple interference effect with Java


For me this effect is a kind of a "hello world" program. Whenever i learned a new language i implemented it. Starting with Pascal, moving to C and inevitably ending as an applet once i gave Java a try.

Physically there is no meaning behind it. It's nonsense (apart from the interference), but it's nice to watch anyway. The setup is simple: Take a bunch of sources that have a "static" wave field attached to them. Move them randomly across a 2D field and sum up the values of all wave fields for each pixel. Let the sources bounce back from walls and you are done.

java plugin is missing

I took a few measures in order to speed the animation up:

Download and Useage


Download icon  Download jar file
Download icon  Download source code (requires Netbeans)

In order to use the applet add the following lines to your html code:

    <object classid="java:intring/intring.class" type="application/x-java-applet" width="300" height="300">
      <param name="archive" value="JIntring.jar"/>
      <param name="code" value="intring/intring.class"/>
      <param name="pixsize" value="1"/>
      <param name="sleep" value="15"/>
      <param name="damping" value="0.01"/>
      <param name="src_num" value="4"/>
    </object>
  

The following table lists the applet parameters and their meaning.

Parameter Meaning
pixsize The size of a pixel
sleep time to wait after each frame (in milli seconds)
damping The damping factor for the sine waves
src_num The number of sources
preview If this value is true the applet looks like an image only moving when the mouse is over the applet.