4

I'm working in a project for university using LaTeX and I'll make a gif explaning the radians of math. And I really don't know how to make this type of line

enter image description here

What I have done so far

\documentclass[border=1cm]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}





\begin{scope}
\draw (0,0) circle (10cm);
\draw[line width=0.15cm, blue] (10,0) arc (0:360:10) ;

\draw[-] (-12,0) -- (12,0) node[right] {$x$};
\draw[-] (0,-12) -- (0,12) node[above] {$y$};
\draw[line width=0.15cm,red] (0,0) -- (10,-0);
\node[scale=15.5, red, right, opacity=0.5] at (2,2) {r};

\draw[red][fill] (0,0) circle (0.2cm);
\draw[red][fill] (10,-0) circle (0.2cm);


  \end{scope}


\end{tikzpicture}

\end{document}
8

A PSTricks solution only for fun purposes.

\documentclass[pstricks,border=12pt,12pt]{standalone}
\radians
\def\obj#1{%
\begin{pspicture}(-4,-4)(4,4)
    \pscircle{4}
    \psset{linecolor=red,linewidth=2\pslinewidth}
    \psarc(0,0){4}{0}{#1}
    \rput{#1}(4;#1){\psline(!0 1 #1 sub 4 mul)}
\end{pspicture}}
\begin{document}
    \foreach \i in {0,0.1,...,1.0}{\obj{\i}}
\end{document}

enter image description here

12

If you wish to produce such animated gifs, you may want to compile

\documentclass[border=1cm,tikz]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\foreach \X in {180,175,...,90}
{\begin{tikzpicture}
\begin{scope}
\draw (0,0) circle (10cm);
\draw[line width=0.15cm, blue] (10,0) arc (0:360:10) ;
\draw[-] (-12,0) -- (12,0) node[right] {$x$};
\draw[-] (0,-12) -- (0,12) node[above] {$y$};
\draw[line width=0.15cm,red,{Circle}-{Circle},shorten >=-2*\pgflinewidth,shorten
<=-2*\pgflinewidth] (10,0) -- ++(\X:10);
\node[scale=15.5, red, right, opacity=0.5] at (2,2) {r};
\end{scope}
\end{tikzpicture}}
\end{document}

with pdflatex and then convert the resulting pdf with

convert -density 300 -delay 34 -loop 0 -alpha remove outfile.pdf ani.gif

to get

enter image description here

When you attempt to patch several of those together, you want to define some command which behaves similarly as the beamer command \only.

\documentclass[border=1cm,tikz]{standalone}
\usetikzlibrary{arrows.meta}
\def\Only<#1-#2>#3{\ifnum\numexpr\X+1>#1
\ifnum\numexpr\X-1<#2
\pgfmathtruncatemacro{\DeltaX}{\X+1-#1}
\xdef\DeltaX{\DeltaX}
#3
\fi\fi}
\begin{document}
\pgfmathtruncatemacro{\Xmax}{50}
\foreach \X in {0,1,...,\Xmax}
{\begin{tikzpicture}[fat line/.style={line width=0.15cm,red,{Circle}-{Circle},shorten >=-2*\pgflinewidth,shorten
<=-2*\pgflinewidth},cc/.style={line width=0.15cm,
blue},annot/.style={scale=15.5}]
\draw[-] (-12,0) -- (12,0) node[right] {$x$};
\draw[-] (0,-12) -- (0,12) node[above] {$y$};
%
\Only<2-5>{
\draw[fat line] (0,0) -- (2*\X,0);
}
\Only<6-10>{
\draw[fat line] (0,0) -- (10,0) node[midway,above,annot,red]{$r$};
}
\Only<11-25>{
\typeout{Delta=\DeltaX}
\draw[cc] (10,0) arc[start angle=0,end angle={\DeltaX*24},radius=10];
\draw[fat line] (0,0) -- ({\DeltaX*24}:10);
}
\Only<26-\Xmax>{
\draw[cc] circle[radius=10cm];
}
\Only<26-35>{\draw[fat line] (10,0)  -- ++ ({180-\DeltaX*9}:10);}
\Only<36-45>{\draw[fat line] (10,0) arc(0:{18*\DeltaX/pi}:10) -- ++
({18*\DeltaX/pi+90}:{10-\DeltaX});}
\Only<46-50>{
\draw [fill=green!70!black,fill opacity=0.2] (0,0) -- (3,0) 
node[green!70!black,below,annot,opacity=1]{rad} arc[start angle=0,
end angle={180/pi},radius=3] -- cycle;
\draw[cc,green!70!black] (10,0) -- (0,0) 
-- ({180/pi}:10);
}
\end{tikzpicture}}
\end{document}

enter image description here

  • I clicked ! Ty so much! But just one more question :D There is a way to put marmot's animation frame by frama separed in diferents pdfs? Or it needs to be one? – Felipe Fonseca Apr 21 at 3:41
  • Like ive done here: prntscr.com/nerl0s and prntscr.com/nerl3o – Felipe Fonseca Apr 21 at 3:42
  • @FelipeFonseca I added something that might be useful for that task. – marmot Apr 21 at 6:16
  • 1
    @FelipeFonseca Here you can find an incomplete list of possibilities to create animations with LaTeX. I feel it would be best if you could go through this list with your advisor and then decide what you want. Apart from animated gifs you can create animated pdf, svg (which can be embedded in web sites) and mp4. You can also employ the full beamer machinery for that. I really think you guys should first have a look at the options before making a quick decision how to proceed. – marmot Apr 22 at 1:14
  • 2
    @FelipeFonseca Please ask a new question. Please note that some users do not like if a user unaccepts an answer just to add an additional request. If you feel you want to unaccept my answer this is up to you but please do not expect me to address additional requests. – marmot Apr 26 at 4:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.