LICEcap can capture an area of your desktop and save it directly to .GIF (for viewing in web browsers, etc) or .LCF (see below).
Sort of related is Sublime Text's hack to animate screenshots.