我的动画和 tikz 文档出现问题

我的动画和 tikz 文档出现问题

135 度的动画出现了一些奇怪的现象。我不知道出了什么问题。

在此处输入图片描述

这是MWE:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{animate}
\newcommand{\crankshaft}[1]{%
        \begin{tikzpicture}[x=0.5cm,y=0.5cm]

            \draw[fill]  (0,0) coordinate [label=180:Z] (Z) circle (2pt);           %% center of the picture
            \draw[fill]  (5,5) coordinate [label=135:Q] (Q) circle (2pt);           %% center of the circle
            \draw[fill]  (Q) -- +(  0:6)   coordinate [label=0:A] (A) circle (2pt); %% first point on the circle
            \clip[draw] (Q)  circle (4.5cm);
            \draw[help lines,blue!20,step=1] (0,0) grid (12,12);
            %% drawing the circle
            \draw[blue]  (A) 
                         let \p1 = ($ (A) - (Q) $) in
                         arc(0:360:{veclen(\x1,\y1)});

            \draw [line width=0.4pt,red]
                  let \p1 = ($(A) - (Q)$), \n1={veclen(\x1,\y1)} in
                  (Q) -- +(#1:\n1)
                  coordinate (B) circle (2pt);

            \draw[purple,line width=0.4pt] 
                  (B) -- +($  (0,0) ! 2em ! 0 : ($(B)-(Q)$)  $)  
                  coordinate [label=center:{\textbf{B:#1}}] (Bl) circle (2em);

            \draw[blue]   
                  ($ (B) ! 0.45 ! (Q) $) 
                  coordinate (tC) circle (2pt);

            \draw[line width=01.5em,->]
                  (tC) 
                  let \p1 = ($(tC) - (Q)$), 
                      \n1={atan2(\x1,\y1)}, %% start angle
                      \n2={\n1+90},         %% end angle
                      \n3={veclen(\x1,\y1)} %% radius
                  in
                      arc (\n1:\n2:\n3)
                      -- ++(\n2+80:1em)
                     ;
        \end{tikzpicture}%
}

\begin{document}

    \begin{animateinline}[autoplay,loop]{1}
    \multiframe{24}{iAng=0+15}{%
        \crankshaft{\iAng}%
    }%
    \end{animateinline}

\end{document}

答案1

PSTricks 中没有角度不连续性。

在此处输入图片描述

\documentclass[pstricks]{standalone}
\usepackage{pst-eucl}
\usepackage{siunitx}
\usepackage{multido}
\addtopsstyle{gridstyle}
{
    griddots=0,
    gridwidth=0.2pt,
    gridcolor=blue!20,
    subgriddiv=5,
    subgridwidth=0.2pt,
    subgridcolor=blue!20,
    gridlabels=0pt,
}

\begin{document}
\multido{\i=0+15}{24}{%
\begin{pspicture}(-4,-4)(4,4)
    \psgrid[style=gridstyle](-2,-2)(2,2)
    \pstGeonode[PosAngle={135,0,180}]
        (0,0){Q}
        (1.8,0){A}
        (-2,-2){Z}
    \pstCircleOA[linecolor=blue!50]{Q}{A}
    \pscircle(Q){3.8}
    \pstGeonode[PointName=none,PointSymbol=none]
        (1;\i){Tail}
        (!1 \i\space 45 add PtoC){Head}
        ([nodesep=2.8]{Tail}Q){C}
    \psarc[arrowscale=0.9,linewidth=3\pslinewidth]{->}(Q){1}{(Tail)}{(Head)}
    \psset{linecolor=red}
    \pscircle(C){1}
    \psline(Q)(C)
    \rput*(C){\textcolor{red}{B:\ang{\i}}}
\end{pspicture}}
\end{document}

相关内容