ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

One Expression to Push 2 objects apart

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Brad Graber
One Expression to Push 2 objects apart
on Mar 24, 2020 at 3:47:09 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


Return to posts index

Andrei Popa
Re: One Expression to Push 2 objects apart
on Mar 24, 2020 at 4:00:24 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.


Return to posts index

Brad Graber
Re: One Expression to Push 2 objects apart
on Mar 24, 2020 at 4:24:51 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


Return to posts index


Andrei Popa
Re: One Expression to Push 2 objects apart
on Mar 24, 2020 at 5:01:00 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.


Return to posts index

Brad Graber
Re: One Expression to Push 2 objects apart
on Mar 24, 2020 at 7:26:21 pm

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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]