ImageFader

Version 2.2 — © 1997-1999 Christian Cohnen

The idea for ImageFader goes back to the Atari ST days: In STOS (The Game Creator) these effects were called Wipes or Fades and were commonly used to switch between the title screen and the actual game — image transitions that plain ST-BASIC completely lacked, and the pride of every hobby developer. The first Java version was written in 1997, and the core concept remained the same: A grayscale image — the fade map — determines the order in which pixels transition. A simple gradient produces a wipe, a noisy texture creates a dissolve. The fade maps were created in Photoshop, which made things much easier than the old days of Deluxe Paint or having to generate transitions algorithmically.

With the blend parameter, images cross-fade directly into each other instead of going through black. Each image can have its own speed and hold time, and smooth controls how soft or hard the transition edge appears. Rendering is done in 24-bit RGB — GIF and JPG images work equally well.

The original applet ran in real time with just a few kilobytes of bytecode. Since browsers no longer support Java applets, here is a screen recording instead — ironic that it takes orders of magnitude more bandwidth to show what a 1997 JVM could do live.

Features

Parameters

NameTypeDescriptionDefaultRequired
image1image10filenameImages to cycle through (GIF or JPG)yes (at least 1)
fadefilenameGrayscale image that controls the transition shapeyes
speedintGlobal transition speed (ms per step)1000no
speed1speed10intPer-image transition speed overrideglobal speedno
waitintGlobal hold time between transitions (ms)1000no
wait1wait10intPer-image hold time overrideglobal waitno
smoothintTransition smoothness — higher values create softer edges400no
blendEnable cross-fade between images (presence enables it)offno
linkURLLink target when applet is clickedno
targetWindowStringTarget window for link (_blank, _parent, etc.)_selfno

Fade Maps

The fade map is a grayscale image that determines the order in which pixels transition. Brighter pixels appear first. Here are some included examples:

Code Example

<applet archive="ImageFader.jar"
  code="ImageFader.class" width="160" height="100">
  <param name="image1" value="oil.gif">
  <param name="image2" value="logo2.gif">
  <param name="image3" value="texture.gif">
  <param name="fade" value="fade.gif">
  <param name="blend">
  <param name="speed" value="200">
  <param name="wait" value="20">
  <param name="smooth" value="500">
  <param name="link" value="https://www.chriscohnen.de">
</applet>

Version History

VersionDateChanges
1.0April 1997First version
2.0October 1999Fade-map-based transitions
2.12004Image sizing, per-image fading times, target window
2.2URL fix, improved error handling during resource loading