Activity › Forums › Adobe After Effects Expressions › Link position to scale expression ?
-
Link position to scale expression ?
Posted by Lucas Piazzini on April 14, 2020 at 12:49 pmHello 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 !
Thank you for the answers in advance =)
Lucas Piazzini replied 6 years, 1 month ago 3 Members · 5 Replies -
5 Replies
-
Andrei Popa
April 14, 2020 at 2:22 pmhttps://www.youtube.com/watch?v=no9gtkH3sGY
Andrei
My Envato portfolio.Some contents or functionalities here are not available due to your cookie preferences!This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.
-
Scott Mcgee
April 14, 2020 at 2:28 pmThis is kind of what you want. I don’t have anything that caps it at a percentage, but hopefully it’ll get you started.
posTwo = thisComp.layer("Shape Layer 2").transform.position.key(1).value[1];
currentPos = thisComp.layer("Shape Layer 2").transform.position[1];x = transform.scale[0] - (100 - (currentPos/posTwo)*100);
y = transform.scale[1];
[x,y] -
Lucas Piazzini
April 14, 2020 at 6:23 pmAfter 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 sizevar 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]]
Reply to this Discussion! Login or Sign Up