我正在尝试沿着一条路径绘制一个大彩色文本,其中颜色遵循渐变。
我发现了一些描述如何沿路径绘制文本的帖子和一些展示如何绘制带有渐变的彩色文本的帖子,但这两种技术似乎不容易融合。
知道如何获得它吗?
--- 编辑 2 ---
最好的情况下,我希望每个字符上都有可见的渐变色,而不是每个字符上都有单一的纯色。
- - 编辑 - -
我尝试沿着路径混合文本,如下所示:
\resizebox{0.5\linewidth}{!}{
\begin{tikzpicture}
\draw[left color=orange!30, right color = orange,decoration={text along path,
text={|\Huge\bfseries|GRADIENT},text align={center}},font=\tiny,decorate] (155:2.75) arc (155:25:2.75);
\end{tikzpicture}
}
使用渐变的彩色文本,例如:
\begin{tikzfadingfrompicture}[name=mypic]
\node [text=transparent!20]
{\fontfamily{ptm}\fontsize{45}{45}\bfseries\selectfont GRADIENT};
\end{tikzfadingfrompicture}
\begin{tikzpicture}
\fill [white] (-5,-1) rectangle (5,1);
\shade[path fading=mypic,fit fading=false, left color=orange!30,right color=orange]
(-5,-1) rectangle (5,1);
\end{tikzpicture}
但我不知道如何将我的第一个 tikzpicture 用作 tikzfadingfrompicture。简单地用一个替换另一个(当然)是行不通的:
\begin{tikzfadingfrompicture}[name=mypic]
\draw[text=transparent!20,decoration={text along path,
text={|\Huge\bfseries|GRADIENT},text align={center}},font=\tiny,decorate] (155:2.75) arc (155:25:2.75);
\end{tikzfadingfrompicture}
\begin{tikzpicture}
\fill [white] (-5,-1) rectangle (5,1);
\shade[path fading=mypic,fit fading=false, left color=orange!30,right color=orange]
(-5,-1) rectangle (5,1);
\end{tikzpicture}
答案1
我的尝试:(参考:pgfmanual.pdf(V3.1.1),第 651 页)
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text,math}
\begin{document}
\bfseries
\begin{tikzpicture}[decoration={text effects along path,
text={GRADIENT}, text align={center},
text effects/.cd,
character count=\i, character total=\n,
characters={text along path, evaluate={\c=\i/\n*100;},
text=brown!\c!black}}]
\path [decorate]
(0,2) .. controls ++(0,1) and ++(0,1) .. (2,2);
\end{tikzpicture}
\end{document}