我正在寻找一种方法来为表面上呈现的渐变文本着色。下面是一个示例,显示了具有渐变的表面和黑色文本。如何更改文本颜色?
\documentclass{standalone}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{name=text}
import graph3;
import contour;
import palette;
size(8cm,IgnoreAspect);
currentprojection=orthographic(-10,-10,8);
limits((0,0,0),(5,10,12));
real f(pair z) {return (z.x+z.y)/(2+cos(z.x)*sin(z.y));}
surface s=surface(f,(0,0),(5,10),50,Spline);
draw(s,mean(palette(s.map(zpart),Rainbow())),black);
string text="lorum ipsum";
real uoffset=1;
real voffset=1;
real h=0.1;
draw(surface(xscale(0.9)*yscale(0.9)*text,s,uoffset,voffset,h));
\end{asypicture}
\end{document}
答案1
好的,那就开始吧。我不认为你选择的表面特别好,但这只是个人喜好问题。问题是在表面上绘制文本并赋予其彩虹色,这实际上并不太难。
\documentclass{standalone}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{name=text}
import graph3;
import contour;
import palette;
size(8cm,IgnoreAspect);
currentprojection=orthographic(-10,-10,8);
limits((0,0,0),(5,10,12));
real f(pair z) {return (z.x+z.y)/(2+cos(z.x)*sin(z.y));}
surface s=surface(f,(0,0),(5,10),50,Spline);
draw(s,red+opacity(0.4));//mean(palette(s.map(zpart),Rainbow())),black
string text="\textbf{lorum ipsum}";
real uoffset=1;
real voffset=1;
real h=0.1;
draw(surface(xscale(0.4)*yscale(0.4)*text,s,uoffset,voffset,h),mean(palette(s.map(zpart),Rainbow())),black);
//draw(surface(xscale(0.9)*yscale(0.9)*text,s,uoffset,voffset,h));
\end{asypicture}
\end{document}
原始答案:
\documentclass{standalone}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{name=text}
size(5cm);
pen[][] p={{white,grey,black},
{red,green,blue},
{cyan,magenta,yellow}};
latticeshade(texpath("text"),p);
\end{asypicture}
\end{document}