# How can I animate multiple objects at once?

I'm new to Mathematica and I'm trying to do this project where I have to animate multiple circles.

I have 4 circles, each with x = 1, 2, 3, 4 , respectively. Each y position is given by a function F(x, n, t). I want to animate the circles with respect to t, manipulate n and have the four circles side-by-side.

I came up with this

Manipulate[
Animate[
Graphics[{Circle[{x, F[x, n, t]}, 0.2]},
PlotRange -> {{0, 6}, {-2, 2}}], {t, 0, 10}],
{n, 1, 4, 1}]


which works for a defined value of x.

Can anyone help me figure out how to animate for all values of x at the same time?

• what's your F[x,n,t] !? – Alrubaie Apr 16 '19 at 19:48

you have to define your F[x,n,t] also work in position x of F[x,n,t] if you want to place them side by side or above each other !???

F[x_, n_, t_] := Sin[n*x*t];

Manipulate[Animate[Graphics[{
{Red, Circle[{x + 2, F[x, n, t]}, 0.2]},
{Blue, Circle[{x, F[x, n, t]}, 0.2]},
{Black, Circle[{x + 1, F[x, n, t]}, 0.2]},
{Green, Circle[{x - 1, F[x, n, t]}, 0.2]}
}, PlotRange -> {{0, 5}, {-2, 2}}],
{x, 0, 5}, {t, 0, 10}], {n, 1, 4, 1}] • The function was defined, I just didn't feel like writing it here. That did do it. Is there any way to make it more compact? Maybe with a cycle for the values of x or something? – Bernardo Silva Apr 16 '19 at 20:48