1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| \begin{tikzpicture}
\draw [thick](-2,-2) -- (-2,2);
\draw [thick](+2,-2) -- (+2,2);
\draw [thick](-2,-2) arc (180:360:2 and 0.5);
\draw[thick,dashed] (2,-2) arc (-2:180:2 and 0.5);
\draw [thick](-2,+2) arc (180:360:2 and 0.5);
\draw [thick](+2,+2) arc (-2:180:2 and 0.5);
\pgfmathsetseed{10}
\foreach \i in {-2,-1,...,15}{
\pgfmathsetmacro{\x}{(rand*0.5 + 1)*3 - 3}
\pgfmathsetmacro{\y}{(rand*0.5 + 1)*4.7-5}
\pgfmathsetmacro{\opacVal}{rand*0.5+1}
\shade [ball color = red, opacity = \opacVal] (\x,\y) circle (0.2);}
\foreach \i in {-2,-1,...,15}{
\pgfmathsetmacro{\x}{(rand*0.5 + 1)*3 - 3}
\pgfmathsetmacro{\y}{(rand*0.5 + 1)*4.7-4.7}
\pgfmathsetmacro{\opacVal}{rand*0.5+1}
\shade [ball color = blue, opacity = \opacVal] (\x,\y) circle (0.2);}
\end{tikzpicture} |
Partager