8

I have used this tikz to generate some GIF. Here are the code and the result. Any idea to make it better

\documentclass[tikz,border={2pt 2pt 2pt 2pt}]{standalone}
 \usepackage{tikz}
 \begin{document}
 \foreach \angle in {0,10,...,360}
{
 \begin{tikzpicture}
 \draw (0,0) circle (1);
 \node at ({cos(\angle)},{sin(\angle)}) {\textcolor{blue}{$\bullet$}};
 \end{tikzpicture}
   }
\end{document}

enter image description here

rihani
  • 153

1 Answers1

14

Update: You could put a larger bounding box around the whole diagram (I think @AndréC's option from the comments is conceptually better than the path I originally had even if the effect is the same), make the loop only go to 350° so you don't get the pause at the end, and change from a bullet in a node to directly drawing a circle. @BlackMild's suggestion to use (\angle:1) instead of the trig functions is also good.

\documentclass[tikz]{standalone}
\begin{document}
\foreach \angle in {0,10,...,350}
{
  \begin{tikzpicture}
    \draw (0,0) circle (1);
    \fill[blue] (\angle:1) circle (0.07);
    \useasboundingbox (-1.1,-1.1) rectangle (1.1,1.1);
  \end{tikzpicture}%
}
\end{document}

MWE output

The animated GIF was created using ImageMagick. It's animation documentation can be found here.

I use a simple shell script for the conversation:

#!/bin/bash

BASE=`basename $1 .pdf`
PDF="$BASE.pdf"
GIF="$BASE.gif"
RESOLUTION=300

CONVERT=/usr/bin/convert
CONVERTOPTS="-density $RESOLUTION -delay 8 -loop 0 -background white -alpha remove"

echo "Converting to TSX GIF..."
$CONVERT $CONVERTOPTS $PDF $GIF > /dev/null
David Purton
  • 25,884