As you can see, the circles are shaking vertically as they approaching each other. Why is that?
The code:
g = Table[
Graphics[{Thickness[0.01],
Table[{ Circle[{0 + x, 0}, r], Circle[{2 - x, 0}, r]}, {r, 0.001,1.0, 0.05}]},
ImageSize -> {800, 400}],
{x, 0, 1, 0.02}];
SetDirectory@NotebookDirectory[]
Export["moire_pattern.gif", g]
Answer
As @mattiav27 already commented, I too suspected an optical illusion so I added two lines to the graphic as in
g = Table[
Graphics[{Thickness[0.01],
Table[{
Red, (*new*)
Line[{{-1, 0.95}, {3, 0.95}}], (*new*)
Line[{{-1, -0.95}, {3, - 0.95}}],(*new*)
Black,(*new*)
Circle[{0 + x, 0}, r],
Circle[{2 - x, 0}, r]}, {r, 0.001, 1.0, 0.05}]},
ImageSize -> {600, 300}], {x, 0, 1, 0.02}];
and the "wobble" is gone. It turns out though that something goes wrong with the graphic with regard to padding or image size without the lines. Try making the lines transparent via Opacity[0]
and still the "wobble" is gone. I suspect adding the two Line
-primitives increases padding somewhat which fixes the issue as shown in @Sumit `s answer.
g = Table[
Graphics[{Thickness[0.01],
Table[{
Opacity[0], (*new*)
Line[{{-1, 0.95}, {3, 0.95}}], (*new*)
Line[{{-1, -0.95}, {3, - 0.95}}],(*new*)
Opacity[1], (*new*)
Black,(*new*)
Circle[{0 + x, 0}, r],
Circle[{2 - x, 0}, r]}, {r, 0.001, 1.0, 0.05}]},
ImageSize -> {600, 300}], {x, 0, 1, 0.02}];
Comments
Post a Comment