2

I've made a script which converts a latex code into an animation, but the thing that is rendered readjusts it's sizes for best fitting in the frame, I want to turn this off as the animation flickers when rendered. Here is the latex Code:

        \documentclass[aspectratio=169]{beamer}
        \usepackage{tikz}
        \usepackage{tkz-euclide}
    \setbeamertemplate{navigation symbols}{}
    \setlength{\parindent}{0pt}
        \begin{document}
        \begin{frame}
        \begin{center}
        \begin{tikzpicture}[scale=0.7]
        \tkzDefPoint(2,0){A}\tkzDefPoint(0,0){O}
        \tkzDefShiftPoint[A](31:5){B}
        \tkzDefShiftPoint[A](*#type-g 1:120 20:3600#* :5){C}
        \tkzDrawPoints(A,B,C)
        \tkzDrawSegments[color = red, line width = 1pt](A,B A,C)
        \tkzProtractor[scale = 1](A,B)
        \end{tikzpicture}
        \end{center}
        \end{frame}
        \end{document}

Here, the *#type-g 1:120 20:3600#* says to tween the value at this place from 20 to 3600 within 1 to 120 frames of the animation.

enter image description here

  • 2
    You probably may enclose it into a (not drawn) square which stays the same along the iterations. By the way, trying to compile your code gave me several errors, either on my distribution and on Overleaf. What did you use? – SebGlav Jul 27 '21 at 14:58
  • *#type-g 1:120 20:3600#* this is not to be written. Replace this with a number. I use texlive in ArchLinux. Thanks, I will try. – Darshan Koirala Jul 27 '21 at 15:02
  • https://tex.stackexchange.com/q/18704/86 has a solution to this which uses the same principle as SebGlav's suggestion but which computes the required bounding box automatically. – Andrew Stacey Jul 29 '21 at 12:45

1 Answers1

3

I think the solution could be to add an \useasboundingbox (tikz) command. As SebGlav suggests in the comment, if you draw a unique rectangle that encloses all the possible figure positions you have it fixed. Then you can change the drawn rectangle for \useasboundingbox with the same vertices. I added, for example:

\useasboundingbox (-3.5,-5.5) rectangle (7.5,5.5);

I changed the code for your animations with something similar (I suppose) that makes different beamer slides. This is what I have:

\documentclass[aspectratio=169]{beamer}
%\usepackage{tikz}
\usepackage{tkz-euclide}
\setbeamertemplate{navigation symbols}{}
\setlength{\parindent}{0pt}

\begin{document} \begin{frame} \begin{center} \begin{tikzpicture}[scale=0.7] \useasboundingbox (-3.5,-5.5) rectangle (7.5,5.5); \tkzDefPoint(2,0){A}\tkzDefPoint(0,0){O} \tkzDefShiftPointA{B} \foreach\i in {1,...,18} {% this produces 18 beamer slides \only<\i> {% \pgfmathtruncatemacro\a{20*(\i-1)+31} % rotation angle \tkzDefShiftPointA{C} } } \tkzDrawPoints(A,B,C) \tkzDrawSegments[color = red, line width = 1pt](A,B A,C) \tkzProtractorscale = 1 \end{tikzpicture} \end{center} \end{frame} \end{document}

enter image description here Edit: Just to see what happens here, look at the following image: enter image description here

Juan Castaño
  • 28,426