如何将右侧路径重新用于左侧路径以便逐步反向显示?

如何将右侧路径重新用于左侧路径以便逐步反向显示?

我的标题可能比较难理解。希望你看完动画后能明白。

我希望左翼像右翼一样一步一步地绘制,但我想使用反向路径方法,这样可以节省更多击键次数。可以吗?

\documentclass{beamer}

\usepackage{pstricks}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{pspicture}
\PreviewBorder=12pt\relax

\makeatletter
\let\Test@pr@shipout\pr@shipout%% save the original definition
\let\Test@shipout\shipout
\AtBeginDocument{%
  \let\pr@shipout\Test@pr@shipout%% restore it 
  \let\shipout\Test@shipout
}
\makeatother


% Define the right part of Batman
\def\RightPart
{
    % start from ear to tail
    \only<1->{\psline(.5,2.7)(1,3.25)}
    \only<2->{\psbezier(1.2,1.3)(1.3,1)(2,1)}
    \only<3->{\psbezier(3,1)(3,2.2)(!3.3 6 72 p2c)}
    \only<4->{\psellipticarcn(6,3.3){(!3.3 6 72 p2c)}{(!3.3 6 72 neg p2c)}}
    \only<5->{\psbezier(4,-2)(4,0)(2.2,-1.8)}
    \only<6->{\psbezier(1.5,-1)(1,-1)(0,-3.2)}
}


\begin{document}

\begin{frame}{Test}
\begin{pspicture}[dimen=m](-6,-3)(6,3)
    % Define a PostScript operator to convert an elliptical point
    % "a b Θ" to its Cartesian "x y"
    \pstVerb{/p2c {dup 3 1 roll cos mul 3 1 roll sin mul} bind def}%
  \pscustom
  {
    % reverse the right part
    % so the drawing starts from the tail
    % to the right wing followed by 
    % the right ear 
    \RightPart
    \reversepath
    % reflect the right part for the left part
    % so the drawing is continued to 
    % the left ear followed by the left wing
    \scale{-1 1}
    \only<7->{\RightPart}
    % close path
    % so the drawing ends at the tail
    \closepath
  }
\end{pspicture}
\end{frame}
\end{document}

在此处输入图片描述

如何将右侧路径重新用于左侧路径以便逐步反向显示?

答案1

reversepath不可能\only

\documentclass{beamer}
\usepackage{pstricks}
\def\RightPart{
    % start from ear to tail
    \only<+->{\psline(0,2.7)(.5,2.7)(1,3.25)}
    \only<+->{\psbezier(1.2,1.3)(1.3,1)(2,1)}
    \only<+->{\psbezier(3,1)(3,2.2)(!3.3 6 72 p2c)}
    \only<+->{\psellipticarcn(6,3.3){(!3.3 6 72 p2c)}{(!3.3 6 72 neg p2c)}}
    \only<+->{\psbezier(4,-2)(4,0)(2.2,-1.8)}
    \only<+->{\psbezier(1.5,-1)(1,-1)(0,-3.2)}
}

\begin{document}

\begin{frame}{Test}
\begin{pspicture}[dimen=m](-6,-3)(6,3)
    \pstVerb{/p2c {dup 3 1 roll cos mul 3 1 roll sin mul} bind def}%
  \pscustom[liftpen=0]{
    \RightPart
    \code{-1 1 scale}
    \moveto(0,2.7)
    \RightPart
  }
\end{pspicture}
\end{frame}
\end{document}

相关内容