After hours of headaches and with the help of my Data scientist father, I was able to make a much simpler and versatile version that revolves around no other constant than a factor unlike school of motion, it also allows you to control the speed of evolution from minimum scale to maximum scale, aswell as the minimum scale ! Thanks for your help I wouldn’t have improved without your link !
Factor = 20 //Control the scale variation, smaller factor = smaller minimum size
var diameter = thisComp.layer("Ball").content("Ellipse 1").content("Ellipse Path 1").size[1];
var ball_yPos = thisComp.layer("Ball Pos").transform.position[1];
var ground = thisComp.layer("Ground").transform.position[1];
var hDepart = diameter*2; //Control the scale speed
var diff_BallGround = ground - ball_yPos;
if (diff_BallGround<hDepart){ //Shadow Scaling
substract = (diff_BallGround/Factor)
}else{
substract=hDepart/Factor // Minimum size
}
if (substract<0){ //To prevent the shadow from getting larger
substract = 0
}
[100-substract,transform.scale[1]]