Java CrankShaft Applet

Java 2 includes an affine transformation class, to use for 2D graphics and animation. However, many (perhaps most) browsers in the field don't have built-in support for Java 2 or the affine transform. This Java applet implements an affine transform using only Java 1.0 classes and methods, so it can be viewed by almost any browser, regardless of vintage.

=== Oops, your browser isn't Java-enabled. ===

Homogeneous coordinates are used, with the third coordinate always set to h = 1. This allows use of a composite transformation matrix which concatenates all needed translations, rotations, and scaling into a single matrix which is then applied to each polygon to be rendered. The result is code that is compact and easy to maintain, with excellent performance at frame rates as high as 10 per second.

Click the link below to see the complete source file. I first built and tested this applet with Apple's MRJ SDK 2.2, but it should build and run with any version of Java on any platform. Please let me know if you find a version or platform that doesn't work. The source code is offered free for all uses, so it's up to you to determine if it is suitable for your application. Source File.


  1. D. Hearn and M. Baker, Computer Graphics--C Version, Upper Saddle River: Prentice-Hall, Inc. 1997.
  2. Lawrence Rodrigues, Building Imaging Applications with Java Technology, Boston: Addison-Wesley, 2001.
  3. David Flanagan, Java Examples In a Nutshell, Sebastopol: O'Reilly & Associates, Inc. 1997.
  4. Information about the Java SDK is available on Oracle's Java Home Page
  5. The Java SDK for Macintosh was previously maintained by Apple Computer, Inc.

Prev Page Home Page Next Page Last updated 4/12/2012 by No Spam Please!