Version 2.1 — © 1996-2003 Christian Cohnen
The Water applet simulates a rippling water surface in real time. Two height fields are updated each frame using a Laplacian kernel that propagates waves across the grid. A small damping factor makes sure waves gradually fade out instead of bouncing forever. The displacement is then added to each pixel's color — bright where the surface rises, dark where it dips — which gives the typical light-refraction look you'd expect from water.
Raindrops fall at a configurable rate, ships cruise along sinusoidal paths generating bow waves, and moving the mouse over the surface creates ripples. You can lay a background image under the water or just use a solid color.
This kind of 2D wave simulation was a classic effect in the Atari ST, Amiga and PC demoscene of the 1990s. The entire core loop runs on integer shifts and additions only — no multiplications, no divisions — which was essential on the hardware of that era and still keeps things fast today.
| Name | Type | Description | Default | Required |
|---|---|---|---|---|
color | Color | Surface color when no image is set | #0000FF (blue) | no |
image | filename | Background image (scaled to applet size) | – | no |
raindrops | int | Raindrops per 10 seconds | 4 | no |
ships | int | Number of ships cruising the surface | 0 | no |
link | URL | Link target when applet is clicked | – | no |
FPS | – | Enables FPS counter (presence enables it, no value needed) | off | no |
<applet archive="Water.jar"
code="Water.class" width="100" height="100">
<param name="link" value="https://www.chriscohnen.de">
<param name="FPS">
<param name="color" value="#0000AF">
<param name="raindrops" value="25">
</applet>