Archive · 1998–2006

Java graphics effects

Some old Java stuff I did years ago: small real-time effects that ran as applets in the browser, drawn pixel by pixel into an image buffer.

Archive · 1998JavaAWTapplets

Applets don't run in browsers any more

Java applet support was removed from all browsers years ago. To see the effects in motion, try the HTML5 versions in the Lab, ported from this code by AI. The original source is still available below.

Star Field

A simple rotating starfield: 2,500 stars flying towards you, growing and brightening as they get closer. Every few seconds the field starts to roll.

Run the HTML5 version →

Water

A small water simulation. Drag with the left mouse button to stir the surface. Right button toggles rain, middle button a rotating vortex. A variant, WaterPix, refracts a picture through the ripples.

Run the HTML5 version →

Blobs

Seven coloured plasma blobs bouncing around and melting together, each one slowly pulsing in brightness.

Run the HTML5 version →

Electric Field

Field lines between moving positive and negative charges, traced step by step from each charge every frame.

Run the HTML5 version →

A tiny plugin framework

All effects share one applet, FxBase. It owns the image buffer, the render loop and the mouse events, and loads the effect class named in the FXPLUGINNAME applet parameter. Each effect implements the FxFace interface. To create a new one, write a class that implements FxFace and pass its name to the base applet.

The zip contains the source of every effect, including two that never made it to the page (FxStarsBlob and a FxTester). The code was rebuilt with the Eclipse IDE in 2006.

FxFace.java
/**
 * FxFace interface definition
 * Main interface for effects "plugin" classes
 * BlackLizard - 1998-2006
 */
public interface FxFace {

    public int FxStart( final Applet parentApplet, final String strArParams[][],
                        final int iParamNum, final WritableRaster renderDevice,
                        Dimension size );
    public int FxStop();
    public void FxRender( int mouseX, int mouseY, int modifiersMask,
                          int mouseClickCount );
    public void FxMouseClicked( int mouseX, int mouseY, int iClickedButton );

}