答案1
这不是很实用的解决方案,但是我正在度假,很无聊。:-)
我尝试用 TikZ 绘制等待符号。结果如下:
\documentclass{article}
\usepackage{scalerel}
\usepackage{tikz}
\definecolorseries{graygrad}{rgb}{last}{white}{black}
\usetikzlibrary{calc}
\newcommand{\waiting}{%
\scalerel*{%
\begin{tikzpicture}
\coordinate (n-0) at (0,0) {};
\pgfmathtruncatemacro\maxcount{100}% Change this if necessary, larger numbers for smoother gradient, but longer compiling time.
\resetcolorseries[\maxcount]{graygrad}%
\pgfmathsetmacro\stepa{315/\maxcount}% 45deg to -270deg
\foreach \ii in {0,...,\numexpr\maxcount-1}{%
\pgfmathtruncatemacro\hi{\ii+1}%
\draw[draw=graygrad!!\ii, double distance=1cm, line cap=round, double=graygrad!!+] (n-\ii) arc [start angle=45-\ii*\stepa, end angle=45-\hi*\stepa, radius=2.5cm] node (n-\hi) {};
}
\end{tikzpicture}%
}{X}%
}
\begin{document}
This is my waiting symbol: \waiting\par
\Huge This is my waiting symbol \waiting.
\end{document}
在我的代码中,有一个数量\maxcount
,您可以更改它来改变符号中灰度渐变的“分辨率”。计数为 100 时,编译大约需要 2-3 秒,因此效率不高。如果数字太小,渐变将显得“锯齿状”且不平滑。
请注意,我还使用了包中的命令scalerel
来缩小符号以供在线使用。resizebox
如果您需要其他尺寸,可以将其移除并使用等。
答案2
答案3
基于 Troy 代码(需要 A-Reader 或 Foxit)的动画旋转器示例。该xsavebox
包用于节省一些最终 PDF 文件的大小。
\documentclass{article}
\usepackage{tikz}
\definecolorseries{graygrad}{rgb}{last}{white}{black}
\usetikzlibrary{calc}
\usepackage{amssymb}
\usepackage{xsavebox}
\usepackage{scalerel}
\usepackage{animate}
\newcommand{\waiting}{%
\begin{tikzpicture}
\coordinate (n-0) at (0,0) {};
\pgfmathtruncatemacro\maxcount{100}% Change this if necessary, larger numbers for smoother gradient, but longer compiling time.
\resetcolorseries[\maxcount]{graygrad}%
\pgfmathsetmacro\stepa{315/\maxcount}% 45deg to -270deg
\foreach \ii in {0,...,\numexpr\maxcount-1}{%
\pgfmathtruncatemacro\hi{\ii+1}%
\draw[draw=graygrad!!\ii, double distance=1cm, line cap=round, double=graygrad!!+] (n-\ii) arc [start angle=45-\ii*\stepa, end angle=45-\hi*\stepa, radius=2.5cm] node (n-\hi) {};
}
\end{tikzpicture}%
}
\newlength\myWidth
\begin{document}\Huge
\xsbox{Waiting}{\waiting}%
\settowidth\myWidth{\scalerel*{\theWaiting}{X}}%
%
This is my waiting symbol:
\begin{animateinline}[autoplay]{24}
\multiframe{80}{iAng=0+-15}{
\hbox to \myWidth{\hss\vbox to \myWidth{\vss\hbox{%
\rotatebox{\iAng}{\scalerel*{\theWaiting}{X}}%
}\vss}\hss}
}
\newframe
\hbox to \myWidth{\hss\vbox to \myWidth{\vss\hbox{%
\huge$\checkmark$%
}\vss}\hss}
\end{animateinline}.
\end{document}