Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions One Expression to Push 2 objects apart

  • One Expression to Push 2 objects apart

    Posted by Brad Graber on March 24, 2020 at 3:47 pm

    Hi All,
    I want to have one expression, null, or slider that pushes two lines in opposite directions (x translates in opp directions) when I move the slider or null. I haven’t been able to find anything like this yet. I’m hopeful, though….

    Thanks!

    BG

    http://www.smoobg.com

    Brad Graber replied 6 years, 4 months ago 2 Members · 4 Replies
  • 4 Replies
  • Andrei Popa

    March 24, 2020 at 4:00 pm

    Not sure about the whole setup but I think this expressions in the position property could solve your problem:

    For the right one:
    distance = thisComp.layer("Null 1").effect("Slider Control")("Slider")/2;
    value+distance

    For the left one:
    distance = thisComp.layer("Null 1").effect("Slider Control")("Slider")/2;
    value-distance

    Andrei
    My Envato portfolio.

  • Brad Graber

    March 24, 2020 at 4:24 pm

    Thanks for your response! See the screenshot below to reference what is happening. This also happened when I entered the expression exactly as you had it:

    http://www.smoobg.com

  • Andrei Popa

    March 24, 2020 at 5:01 pm

    I think you should first make the lines vertical and parent them to the NULL. Then rotate the null until they get in the position you want. Then add this to the x position property:

    The right one:
    var dist = thisComp.layer("Scale Null 2").effect("Slider Line Separator Control")("Slider");
    value+dist

    The left one:
    var dist = thisComp.layer("Scale Null 2").effect("Slider Line Separator Control")("Slider");
    value-dist

    Andrei
    My Envato portfolio.

  • Brad Graber

    March 24, 2020 at 7:26 pm

    Andrei Popa, this worked perfectly! Thanks so much! Maybe I’ll post a finished product or something…

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