Generate smooth animations?

I love using Graphics[] in Mathematica. For the most part, it does a great job, and is easy to use. However, when creating animations, its images tend to be “jittery” on playback. For example, a single vertical line moving to the right:

frames = ParallelTable[Rasterize[Graphics[
     Line[{{a, 0}, {a, 1}}],
     PlotRange -> {{0, 0.1}, {0, 1}}
     ]], {a, 0, 0.1, 0.001}];
ListAnimate[frames]

6385frames.gif

When viewed in-notebook or exported, the animation tends to “throb” or “blink”, at any magnification. Does anyone else experience this issue and have insight on how to deal with it?

I do not know the reason but will note that some options to Rasterize have Automatic settings. Possibly giving explicit values to e.g. ImageSize might help.

The problem seems to persist regardless of the choice of raster size, image size, or without calling Rasterize[] at all.

Hi Sam,

I guess you see this effect because your vertical line runs parallel to the pixel columns of your screen, and this can be problematic. (E.g. in digital radiology this is a known pitfall - one always makes sure that field borders are somewhat rotated against pixel rows/columns.) And in fact when you do the same using a non-vertical line the effect is basically gone:

frames = ParallelTable[
   Graphics[Line[{{a, 0}, {a + .1, 1}}], 
    PlotRange -> {{0, 0.21}, {0, 1}}], {a, 0, 0.1, 0.001}];
ListAnimate[frames]