考虑一下代码
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=3.0]
\def\rS{1.3} % Radius of Sun
\shade[%
top color=yellow!70,%
bottom color=orange!50,%
shading angle={45},%
](0, 0) circle (\rS);
\end{tikzpicture}
\end{document}
产生了以下太阳图像
下面的图片是我摘录的https://solarsystem.nasa.gov/solar-system/sun/overview/
问题:我怎样才能使 tikz 太阳更像 NASA 图像的强度和光环?
谢谢。
答案1
有人可能会想出更好的答案,因为我认为这对可变大小的太阳不起作用。但效果还不错:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows}
\pgfdeclareradialshading{sunfading}{\pgfpointorigin}{
color(0pt)=(pgftransparent!100); color(15bp)=(pgftransparent!90);
color(20bp)=(pgftransparent!20);
color(25bp)=(pgftransparent!100); color(50bp)=(pgftransparent!100)}%
\pgfdeclarefading{sun fading}{\pgfuseshading{sunfading}}%
\begin{document}
\begin{tikzpicture}[scale=3.0]
\def\rS{1.3} % Radius of Sun
\fill[black] (-1.7,-1.7) rectangle (1.7,1.7);
\shade[%
top color=yellow!70,%
bottom color=orange!50,%
shading angle={45},%
](0, 0) circle (\rS);
\path[circular drop shadow={%
shadow scale=1.2, shadow xshift=0pt, shadow yshift=0pt,
fill=yellow, path fading=sun fading,
every shadow,
}] (0, 0) circle (\rS);
\end{tikzpicture}
\end{document}