Animation using primitives.

Click on the applet to change the rotation point. Right-clicking reverses the animation.
You can also click and drag to change the rotation point.
The little scrollbar increases the delay between animation steps. Check the status bar for a speed readout.
This figure was created by the mathematician Penrose. Look closely if you haven't seen one of these triangles before. It is not as simple as it seems!
A simple rotation equation is used to get the figure spinning.
xpoints[i] = (float)(old_x * Math.cos(angle) + old_y * Math.sin(angle));
ypoints[i] = (float)(old_y * Math.cos(angle) - old_x * Math.sin(angle));
Each of the three parts is derived from an "animated polygon" class which encapsulates the animation behaviour.
Double-buffering is used to eliminate flicker.
The animation loop runs within the Applet's run method.