If you have particular it’s kinda easy but not perfect
Assuming you have P1, P2 layers as starting and end points
Make a new layer on top of Particle layer and apply Circle effect. Make this layer continuously rasterize so the circle can go out of layer bounds. And select Circle layer as the particle layer’s track matte. Finally add the following expressions:
Circle – Center:
thisComp.layer("P1").transform.position;
Circle – Radius:
p1 = thisComp.layer("P1").transform.position;
p2 = thisComp.layer("P2").transform.position;
length(p1,p2);
Because you’re using the circle layer as alpha matte, the particles at the end will be cut out..
Particular setup:
Adjust Particles/sec, velocity etc. as you like. Particle Life should be enough to travel from P1 to P2 so set that based on the distance between points and particle velocity.
Direction: Directional
Direction Spread [%]: 0
X Rotation: 90;
Position XY:
temp = thisComp.layer("P1").transform.position;
[temp[0], temp[1]]
Y Rotation:
p1 = thisComp.layer("P1").transform.position;
p2 = thisComp.layer("P2").transform.position;
angle = p1-p2;
radiansToDegrees(Math.atan2(angle[1],angle[0])) - 90;