Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Seemingly a simple task that I can’t figure out – moving in opposite directions

  • Seemingly a simple task that I can’t figure out – moving in opposite directions

    Posted by Ilya Gusinski on October 23, 2020 at 1:52 pm

    So here is the setup… A circle that needs to have four controllers (shape layers) that if moved, will distort the circle evenly… meaning if I pull one controller the opposite one will move in the opposite direction an equal amount…

    The setup I am trying to use is this:

    I have created a shape layer circle, converted the path to bezier path and then i used the built in script to have points follow nulls. Now I want to be able to set it up that if I move one null the opposite one moves an equal amount in the opposite direction. And it seems that no matter what I try (and admittedly I am trying pretty simple solutions that I could come up with since I am not a wiz with expressions)

    so what I have tried so far is to have a center null, and then I calculate the distance between the center null and each of the four circle nulls and out put it as a value to a slider… I limit the top and bottom null only to Y axis travel and left and right null to X axis travel. Knowing the radius of the circle (250px) I can figure out the distance each null is moved.

    250-length(thisComp.layer("Top").transform.yPosition,transform.yPosition)

    and so on for each of the four nulls.

    Then I try to add an expression to the each of the nulls that has this:

    var topToCenter=thisComp.layer("Center").effect("Top To Center")("Slider")

    var bottomToCenter= thisComp.layer("Center").effect("Bottom To Center")("Slider")

    var distanceTraveled = topToCenter+bottomToCenter;

    value = value-distanceTraveled

    and then depending whether I need to add or subtract its value-distanceTraveled or value+distanceTraveled


    The problem is that doesn’t work… seems like a circular reference that I can’t figure out how to get around…. any suggestions will be hugely welcomed!


    Thanks in advance…

    Ilya Gusinski replied 5 years, 6 months ago 4 Members · 7 Replies
  • 7 Replies
  • Matt Volp

    October 27, 2020 at 9:16 am

    Yeah, the issue here is that you also need to update the bezier handles as you make the circle bigger. You have two options.

    1. Redo your process with this script instead: https://lesterbanks.com/2017/10/create-nulls-paths-extended-features/ and make sure ‘handle controls’ is checked. Then you’ll also need to animate the scale of each of the 4 nulls too, to keep the circle shape.

    2. Don’t convert the circle to bezier path and use more complex maths to get what you want.

  • Filip Vandueren

    October 27, 2020 at 9:28 am

    It would be easiest if you create pairs of one leader, one follower, so you move the left one and the right one responds, but not the other way around too. Because indeed, in the world of expressions, that creates a circular (hehe) logic that can’t work.

  • Ilya Gusinski

    October 27, 2020 at 4:58 pm

    Thanks for the suggestion – in fact I have been using that script (you can also use Duik’s “add bones” to do the exact same thing too)

    but my problem is not this… my problem is that I can’t figure out how to make it so when I move one set of points the opposite set moves the same amount but in the opposite direction – and that it works on both sides… I understand that this is a somewhat convoluted explanation but let me clarify:

    the circle path has 4 points Up, Down, Left, Right – so i want to achieve is when I, for example move the Up point 130px on Y axis the down point moves 130px in the opposite direction and the same will be achieved if I move any other point – the opposite moves in opposite direction…

    I also have tried to achieve this by using scale separately on X axis and Y axis, but the problem is that I don’t want to have a slider controller but a physical controller that I can drag… and I can’t figure out how to map the the scale linear function to two separate physical controllers…

  • Brendon Murphy

    October 27, 2020 at 7:25 pm

    As Filip said, make maybe the top null and right null the drivers. Put this expression in the “Left” null position:

    rightPos = thisComp.layer("Right").transform.position;

    centerPos = thisComp.layer("Center").transform.position;

    yMirror =rightPos[1];

    xMirror = centerPos[0]-(rightPos[0]-centerPos[0]);

    [xMirror,yMirror];

    And this in the “Down” null position:

    topPos = thisComp.layer("Up").transform.position;

    centerPos = thisComp.layer("Center").transform.position;

    xMirror = topPos[0];

    yMirror = centerPos[1]-(topPos[1]-centerPos[1]);

    [xMirror,yMirror];

    End result:

  • Brendon Murphy

    October 27, 2020 at 7:25 pm
  • Brendon Murphy

    October 27, 2020 at 7:53 pm

    This actually shows it better

  • Ilya Gusinski

    October 27, 2020 at 9:54 pm

    This does work! thank you Filip & Brendon

    I did it slightly differently – more like what Filip suggested – so I have 4 Point controllers (from DUIK Bones – UP DOWN LEFT RIGHT) then I add additional 4 Nulls UP2 DOWN2 LEFT2 RIGHT2.

    Then with DUIK, I zero out each NULL and Controller.

    I parent UP to UP2 and LEFT TO LEFT2 and so on.

    Then I parent the position of LEFT2 to RIGHT but add a “-” before so it looks something like this: -thisComp.layer(“RIGHT”).transform.xPosition and so on for each of secondary controllers (the ones with 2)

    and it works pretty well! So thanks Filip!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy