以下是一个简单的例子。我想学习如何使用\only<>
(如果可能)有条件地启用宏的键值对。
\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
\def\RightPart{
% start from ear to tail
\only<+->{\moveto(.5,2.7)}
\only<+->{\psline(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)}
}
\def\LeftPart{
% start from tail to ear
\only<+->{\psbezier(1,-1)(1.5,-1)(2.2,-1.8)}
\only<+->{\psbezier(4,0)(4,-2)(!3.3 6 72 neg p2c)}
\only<+->{\psellipticarc(6,3.3){(!3.3 6 72 neg p2c)}{(!3.3 6 72 p2c)}}
\only<+->{\psbezier(3,2.2)(3,1)(2,1)}
\only<+->{\psbezier(1.3,1)(1.2,1.3)(1,3.25)}
\only<+->{\psline(.5,2.7)}
\only<+->{\closepath}
}
\begin{document}
\begin{frame}
\begin{pspicture}[dimen=m](-6,-3)(6,3)
\pstVerb{/p2c {dup 3 1 roll cos mul 3 1 roll sin mul} bind def}
%\pscustom[\only<15->{fillstyle=solid,fillcolor=yellow}]
\pscustom[fillstyle=solid,fillcolor=yellow]
{
\RightPart
\code{-1 1 scale}
\LeftPart
}
\end{pspicture}
\end{frame}
\end{document}
那么我该如何使用才能\pscustom[\only<15->{fillstyle=solid,fillcolor=yellow}]
让我最后填充封闭区域?请不要建议我使用,psclip
因为这不是我想要学习的。
答案1
您可以使用可以包装的选项,而不必fillstyle
直接提供选项。因此,代码中的相关更改是:\pscustom
\fill[fillstyle=solid, fillcolor=yellow]
\only
\pscustom{
\RightPart
\code{-1 1 scale}
\LeftPart
\only<+->{\fill[fillstyle=solid, fillcolor=yellow]}
}