
如何對垂直於 x 軸的半圓外側進行著色,使得顏色隨著遠離半圓而逐漸褪色?謝謝您的幫忙!
\begin{tikzpicture}
\draw[blue] (-1,0) .. controls (-1,0.555) and (-0.555,1) .. (0,1)
.. controls (0.555,1) and (1,0.555) .. (1,0);
\draw (-2,0) -- (2,0);
\end{tikzpicture}
答案1
這可能有點愚蠢,但會滿足您的要求。
輸出
程式碼
\documentclass[tikz,border=5pt]{standalone}
\begin{document}
\begin{tikzpicture}
\def\ymax{3}
\def\xmax{3}
\begin{scope}
\clip (-\xmax, 0) rectangle (\xmax, \ymax) ;
\shade[inner color=red,outer color=white] (0,0) circle (3);
\draw[blue, fill=white] (0,0) circle (1) ;
\end{scope}
\draw [thick, ->] (-\xmax,0) -- (\xmax,0) ;
\end{tikzpicture}
\end{document}