ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Link position to scale expression ?

FAQ   •   VIEW ALL Link position to scale expression ? on Apr 14, 2020 at 12:49:16 pm

Hello guys ! First of all hello, this is my first post here ☺

I am doing a bouncing ball animation with expressions and would like to create it's shadow. I'd like to make it scale based on the ball's height (position, more generally), but I am quite running out of ideas to transcribe it's height into a %.. I need help please ! Re: Link position to scale expression ?on Apr 14, 2020 at 6:23:14 pm

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; var ball_yPos = thisComp.layer("Ball Pos").transform.position; var ground = thisComp.layer("Ground").transform.position; 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&lt;0){ //To prevent the shadow from getting larger substract = 0 } [100-substract,transform.scale]``` Re: Link position to scale expression ?on Apr 14, 2020 at 2:28:11 pm
```posTwo = thisComp.layer("Shape Layer 2").transform.position.key(1).value; currentPos = thisComp.layer("Shape Layer 2").transform.position; x = transform.scale - (100 - (currentPos/posTwo)*100); y = transform.scale; [x,y]```