So I can generate random positions for the multiple copies of the layers but they still will be respond to the movement of Attracting Layer.
One of the expressions just don't work if another pasted below.
Probaly I must edit this line "position + displacementVec" and add this random positions values to this. But I don't know how.
English is not my native language so I hope someone will understand this.
I will be very grateful for help.
i think you just need to use your random positioning statement as the 'position' in the repelling statements... avoidPos = thisComp.layer("Attracted Layer").position;
maxDisplacement = thisComp.layer("Controls").effect("max disp")("Slider"); //maximum amount to move the layer
minDistance = thisComp.layer("Controls").effect("min distance")("Slider"); //minimum distance to begin displacing at
vec = avoidPos - [X,Y,Z];
directionVec = normalize( vec );
distance = length( vec );
displaceAmt = ease( distance , 0 , minDistance , 0, maxDisplacement );
displacementVec = displaceAmt * directionVec;
position + displacementVec;
if that still gives you problems, you could do the random positioning expression first, then convert that expression to keyframes, then apply the second expression. if you choose copy expression only for a selected layer, you can then paste it onto a all selected layers, so it would be pretty easy too.