![如何淡化曲线网格的颜色](https://linux22.com/image/441588/%E5%A6%82%E4%BD%95%E6%B7%A1%E5%8C%96%E6%9B%B2%E7%BA%BF%E7%BD%91%E6%A0%BC%E7%9A%84%E9%A2%9C%E8%89%B2.png)
我想绘制如下图所示的曲线网格。
请帮我用腹部控制网格并淡化颜色。
平均能量损失
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\foreach[count=\j] \i in {3,3.5,...,10.5}{
\pgfmathsetmacro{\xb}{0.4-0.05*\j}
\pgfmathsetmacro{\yb}{11-0.01*\j}
\pgfmathsetmacro{\xc}{7-0.3*\j}
\pgfmathsetmacro{\opa}{100-0.5*\j}
\draw[thick,cyan!\opa] (\i,27) .. controls +(270:6) and +(80:4.5)..
(\xb,\yb)..controls +(260:4.5) and +(75:4.6)..(\xc,0);
}
\end{tikzpicture}
\end{document}
2021 年 5 月 11 日更新,彩虹色代码
\documentclass[tikz]{standalone}
\begin{document}
\def\n{30}
\begin{tikzpicture}
\foreach[count=\j] \i in {3,3.5,...,10.5}{
\pgfmathsetmacro{\xb}{0.4-0.05*\j}
\pgfmathsetmacro{\yb}{11-0.01*\j}
\pgfmathsetmacro{\xc}{7-0.3*\j}
\pgfmathsetmacro{\opa}{100-0.5*\j}
\pgfmathsetmacro{\faktor}{(\j-1)*400/\n+350}
\definecolor{rainbow}{wave}{\faktor}
\draw[ultra thick,rainbow] (\i,27) .. controls +(270:6) and +(80:4.5)..
(\xb,\yb)..controls +(260:4.5) and +(75:4.6)..(\xc,0);
}
\end{tikzpicture}
\end{document}
答案1
您的代码修改如下:
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\foreach[count=\j] \i in {3,3.5,...,10.5}{
\pgfmathsetmacro{\xb}{0.4-0.05*\j}
\pgfmathsetmacro{\yb}{11-0.01*\j}
\pgfmathsetmacro{\xc}{7-0.3*\j}
\pgfmathsetmacro{\k}{int(\j*100/16)}
\draw[thick,cyan!\k] (\i,27) .. controls +(270:6) and +(80:4.5)..
(\xb,\yb)..controls +(260:4.5) and +(75:4.6)..(\xc,0);
}
\end{tikzpicture}
\end{document}
你会得到这样的结果: