I'm trying to track the movement of a bunch of particles by adding fading trail effect and dynamically update particle's position. However, when I need to track several hundreds of them, drawing may take too much time, making dynamic updating impossible. So I would like to ask are there any way to create an effective fading trail effect in Mathematica, maybe proper tuning of Dynamic or drawing method may help.
The effect I would like to achieve is as follow:
(*Test data*)
priml = Table[# + {.07 k, Sin[.15 k]} & /@ Tuples[Range@15, 2], {k,
130}];
cf = Blend[{Yellow, Blend[{Orange, Red}]}, #/1.5] &;
coll = cf /@ Range[0., 1.5, 0.05];
sizel = .15 Range[0., 1.5, .05]^1.5;
(*Update position*)
Do[
FinishDynamic[];
track = priml[[i ;; i + 30]];
, {i, 100}] // AbsoluteTiming
(*Dynamically create the fading trail effect.*)
Dynamic@Graphics[
Thread[{coll,
MapThread[
Function[{dat, size}, Disk[#, size] & /@ dat], {track, sizel}]}],
PlotRange -> {{-2, 25}, {-2, 17}}]
Well, but for simplicity, the first step could be setting sizel to a constant array ConstantArray[.15,31].
Actually the only change between two consecutive frames is the addition of new head, deletion of the tail, and the alternation in color, so I strongly suspect lot of time could be saved by proper updation instead of complete redraw the graphics.
In my real application, the calculation in a single Do loop takes about 0.5s, so a drawing time less than 0.05s would be satisfying.
Any idea?
Note: Slight decrease in quality is accepted, e.g. Raster method is allowed


ColorCombine. As the color function is just a linear blend so it won't be that hard. – Wjx Apr 07 '17 at 08:21Translate. For example useMapThread[{#1, Translate[Disk[{0, 0}, #2], #3]} &, {coll, sizel, track}]as your Graphics expression. – Simon Woods Apr 07 '17 at 19:02