我想知道是否有一个乳胶包可以获取网络上经常看到的伪 3D 风格的“按钮”,或者如果没有,是否有一种简单的方法来绘制它们?
举个例子来说明我的意思:
答案1
这是使用 tikz 创建的简单按钮的示例:
\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[
button/.style={
rectangle,
minimum size=6mm,
very thick,
rounded corners,
draw=red!50!black!74,
top color=red!50!black!70,
bottom color=white,
}]
\node[button] (button) {A Button!};
\begin{scope}[opacity=.6, transparency group]
\draw[white,fill=white,rounded corners={2pt}] ($ (button.north west) + (3pt,-3pt) $) rectangle ($ (button.north east) + (-3pt,-8pt) $);
\draw[white,fill=white,rounded corners={.5pt}] ($ (button.north west) + (3pt,-5pt) $) rectangle ($ (button.north east) + (-3pt,-8pt) $);
\end{scope}
\draw[white,fill=white,opacity=.8,rounded corners={1pt}] ($ (button.south west) + (5pt,2pt) $) rectangle ($ (button.south east) + (-5pt,4pt) $);
\end{tikzpicture}
\end{document}
然后我使用 pdfcrop 裁剪文件,并使用 gimp 将 pdf 转换为 png:
基本上,您所做的事情与在 Inkscape 中做的事情相同,只是您对淡入淡出等功能的支持不太好,因此会受到一些限制。
答案2
这里是这个启发性问题和答案的一个小游乐场(纯 tex 格式;可调整为乳胶等):
\input tikz
\usetikzlibrary{shapes.geometric,shapes.symbols,shadows}
\tikzpicture[
button/.style={text=white,draw=#1!50!black,
preaction={drop shadow={shadow scale=1.05,shadow xshift=0pt,shadow yshift=-1pt}},
top color=#1!10,bottom color=#1!50!black,inner xsep=2ex,inner ysep=1.6ex,
},
plastic/.style={button=#1,shape=rectangle,rounded corners=1.6ex},
oval/.style={button=#1,shape=rectangle,rounded corners=2.5ex,ball color=#1},
any size/.style={button=#1,shape=ellipse,inner xsep=1ex, inner ysep=1ex},
slick/.style={button=#1,shape=tape,tape bend height=1ex,inner sep=1ex},
candy wrap/.style={button=#1,shape=rectangle,rounded corners=5ex},
smooth/.style={button=#1,shape=rectangle,rounded corners=2ex,
top color=#1!50!black,shading angle=45,bottom color=#1!10}
]
\draw (0,0)
\foreach \color in {red,green,blue} {
\foreach \shape in {plastic,oval,any size,slick,candy wrap,smooth} {
node[\shape=\color] {\shape} ++(2.5,0)
}
++(-15,1)
};
\endtikzpicture
\bye