# Combine three 2D graphics with animation

I am trying to simulate three kind of points (different color) entering a 2D rectangular region from different sides with animation. Below is my code:

rPointList=Module[{t},Table[If[t<1,{x[0]=0,y[0]=RandomReal[{0,10}]},
{x[t]=RandomReal[{0,1}],y[t]=RandomReal[{0,1}]}],{t,0,10}]];
bPointList=Module[{t},Table[If[t<1,{x[0]=10,y[0]=RandomReal[{0,10}]},
{x[t]=RandomReal[{-1,0}],y[t]=RandomReal[{0,1}]}],{t,0,10}]];
rGraphicsList=Graphics[{Red,PointSize[0.03],Point[#]},AxesLabel->{"x","y"},
PlotRange->{{0,10},{0,10}}]&/@rPointList;
bGraphicsLIst=Graphics[{Blue,PointSize[0.05],Point[#]},AxesLabel->{"x","y"},
PlotRange->{{0,10},{0,10}}]&/@bPointList;
ListAnimate[Show[rGraphicsList,bGraphicsList]]


In the code, These points are moving with t. My code only shows me the result at finally time. How to show the points moving with t? Thanks.

Not sure about your strategy generating the data, but provided you have already defined {rGraphicsList, bGraphicsList, blGraphicsList}, then you can do

ListAnimate[
Show @@@ Transpose[
{rGraphicsList, bGraphicsList, blGraphicsList}
]
]


Here @@@ stands for Apply as in Apply[f,expr,{1}] or f@@@expr replaces heads at level 1 of expr by f. Effectively making

f @@@ {{a, b, c}, {d, e, f}, {g, h, i}}

{f[a, b, c], f[d, e, f], f[g, h, i]}

• Great! Thanks a lot! Feb 8 '16 at 22:09