Many processes have been proposed for such a curve evolution. See references below. It is difficult to define a process that shortens curves without introducing singularities or new intersections. The applet below implements an approach introduced in the paper Shortening Curves on Surfaces by Joel Hass and Peter Scott, Topology 33, (1994) 25-43. For curves in the plane, the process shrinks a curve to a point. while monotonically reducing the number of self-intersections.
If you uncheck the button labeled "leave a trace", the curve will erase and redraw each time it evolves.
This applet was programmed in Java by Richard Vaughn and Joel Hass.
The basic idea of the algorithm is simple:
1. Cover the screen with squares.
2. Replace the intersection of a curve with a given square with straight arcs having the same boundary points on the square's boundary.
3. Offset the squares by 1/3 of their widths and heights. Repeat step 2.