Today, I was in the mood for “*social distancing*” (it’s all the rage these days!), so I decided to try implementing a simple particle system in G’MIC.

The idea : putting a lot of particles in the same image, with the rules:

- Particles should move away from each others, and from the image border.
- plus added a repulsive particle that is moving fast.

And see what happened… I’ve found it quite nice, so I’m posting it here

A more higher-resolution video is available here :

For those interested, here is the G’MIC script that generates the frames:

```
foo :
512,512,1,3
1,300,1,2,u(w#-1-1)
t=0
do
xrep,yrep={w#0*(0.5+0.3*[cos(4.2*$t),sin(2.7*$t)])}
t+=0.01
# Render particles.
+f.. 0 eval.. ">ellipse(#-1,R,G,2,2,0,1,255)"
circle. $xrep,$yrep,8,1,255,0,0
*... 'd=y/h;[0.24+0.75*d,0.92,0.99-0.3*d]' max[0,-1]
w..
# Compute and apply particle velocity.
+. '"*
add_veloc(Q,strength,sigma) = (
U = P - Q;
nU = norm(U);
U/=max(1e-5,nU);
w = strength*gauss(nU,sigma,0);
sumw+=w;
V+=w*U;
);
P = I(#1);
V = [ 0,0 ];
sumw = 0;
for (p = 0, p<h, ++p, p!=y?add_veloc(I[#1,p],5,10));
add_veloc([0,P[1]],10,40);
add_veloc([w#0-1,P[1]],10,40);
add_veloc([P[0],0],10,40);
add_veloc([P[0],h#0-1],10,40);
add_veloc(["$xrep,$yrep"],50,50);
2.8*V/sumw"'
wait 30
while {*}" && "!{*,ESC}
rm w[] 0
```