I am interested in producing a series of balls which contain a pictorical idea of movement, to represent a gas. As such, I would like to apply a rotation in each of this set of "balls in motions" (which I shall refer henceforth as just mballs) according to random angles.
My code so far looks like this
\documentclass{article}
\usepackage{tikz}
\usepackage{xcolor}
\usetikzlibrary{arrows,snakes,backgrounds}
%Colors%
\definecolor{Red}{rgb}{0.922526, 0.385626, 0.209179}
%Defs%
\def\ball at (#1,#2){\draw[fill=Red!30,Red!30] (#1,#2) circle (4pt);
\draw[fill=Red!50,Red!50] (#1,#2)+(.15cm,0) circle (4pt);
\draw[fill=Red!70,Red!70] (#1,#2)+(.3cm,0) circle (4pt);}
\begin{document}
\begin{tikzpicture}
\foreach \x in {-2,...,2}
\foreach \y in {-2,...,2}
{\ball at (\x,\y)}
\end{tikzpicture}
\end{document}
Which produces
I tried a couple of things so far, but my problem is, particularly, to let each of this mballs acquire a different angle. That is, the randomness of the angles is not a big deal, but if I try to add an angles in the loops, which could depend for example on the variables \x or \y it just doesn't work, I mean, I tried something like
\foreach \x in {-2,...,2}
\foreach \y in {-2,...,2}
{[rotate=15*\x*\y]\ball at (\x,\y)}
or even for a fixed angle
\foreach \x in {-2,...,2}
\foreach \y in {-2,...,2}
{[rotate=30]\ball at (\x,\y)}
or even for a fixed angle. So, to wrap up, my questions are:
(1) How should I adjust my syntax for this to work? That is, I'd like to still be able to perform the loop and apply a rotation to the mballs in each step.
(2) Not so important, but relevant, what's the best way to implement the randomness in such angle?


rotate=...should be inside your\drawoptions. Also, the manual mentions\pgfmathrandominteger{<macro>}{<min>}{<max>}, so if you add, say,\pgfmathrandominteger{\nice}{-20}{20}just before the\draws in your definition and then\draw[rotate=\nice,<more stuff>], you should have a randomized rotation. – Dec 28 '20 at 18:12\def\ball at (#1,#2){ \pgfmathrandominteger{\nice}{-20}{20} \draw[fill=Red!30,rotate=\nice] (#1,#2) circle (4pt); \draw[fill=Red!50,rotate=\nice] (#1,#2)+(.15cm,0) circle (4pt); \draw[fill=Red!70,rotate=\nice] (#1,#2)+(.3cm,0) circle (4pt);}– Dec 28 '20 at 19:00