Activity › Forums › Adobe After Effects Expressions › Lines that move opposite from another on the Y axis
-
Lines that move opposite from another on the Y axis
-
Steven Tapia
September 24, 2022 at 11:44 pmHello All,
I’ve visiting this site for years, but was always scared to ask a question, but here I go. I have a text animation with a line that animates in above and below it. Both of these lines are rigged to nulls that control the in and out points of each line. These nulls also control the points of a matte that reveals the text. It’s a complex rig for me to manage.
I would like to rig both lines so that where ever the top line moves the bottom line follows, but in the opposite direction in Y position. I want to make this as a template so that I can use it about a 100 times through out a project. Any Help would be awesome! Thanks!
Steven
-
Andrei Popa
September 25, 2022 at 5:13 pmI think you should add this to the yPosition of the layer “Bottom Line Right Null”
zeroPos = 960;
P = thisComp.layer("Top Line Right Null").transform.yPosition;
zeroPos + zeroPos - P; -
Steven Tapia
September 27, 2022 at 11:01 pmThis Expression worked, but I would love an explanation about it, if you have some time. Thanks
-
Andrei Popa
October 1, 2022 at 6:24 amHi Steven. Here is the explanation.
zeroPos is the vertical position where you start your vertical animation.
zeroPos – P is the difference between the starting point and the current point of the other bar.
We add these and we get the position of the second bar relative to the first one.
If the first one was going up, zeroPos – P was positiove, and so the position of the second would increase. If the first one was going down, zeroPos – P was negative, and the position of the second would decrease. We just added to zeroPos the difference. If the mirror axes would have been zero, this expression would have been just -P.
Reply to this Discussion! Login or Sign Up
Log in to reply.