-
layer position distribution using expressions
Hi! I’ve been stumped trying to get an animation to work without hand animating positions – in an effort to save keyframes and time. I’ve got five nulls that are positioned from top to bottom, and i’d like to make it so that if i animate the position of the top null, the rest follow suit/evenly distribute. i’ve been trying to figure out a way to do it, and i feel like i’ve got some start by using an average expression, but this only gives me the midpoint, essentially the third null. i’m not sure of the math that it would take for the rest of the nulls. currently i have:
function average(a, b)
{
return (a + b) / 2;
}
average(thisComp.layer("001").transform.yPosition, thisComp.layer("005").transform.yPosition );but if i change the value from 2, it doesn’t stay inside of the parameters of 001 and 005 position. i’m clueless. essentially it’s like i want the distribute layers button, but in an expression. i’d been told that i should try an ik but i don’t really need rotation.
any help would be greatly appreciated, thank you.
ken