Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Scale Relative to X/Y Position with negative values

  • Scale Relative to X/Y Position with negative values

    Posted by Ian Thomson on October 16, 2008 at 4:33 pm
    temp=effect("Separate XYZ Position") ("X Position")+100;
    [temp,temp,temp]

    Hi!

    I am new to expressions; but I am trying to set up a comp that will automatically scale the image relative to X and Y sliders.

    My expression works fine for values greater than 0 but how can I keep the scale value positive if the X slider goes into the negative range?

    I have not gotten to the Y value yet!

    Any help is appreciated!!
    Thanks,
    Ian

    Ian Thomson replied 17 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Brendan Mccullough

    October 16, 2008 at 8:29 pm
    temp=effect("Separate XYZ Position") ("X Position")+100;
    if(temp<0) temp *= -1;
    [temp,temp,temp]

    You want to check if the value goes below 0, and if it does, multiply it by -1, which will make it positive. Just apply the concept to any of your variable you want to keep positive.

  • Ian Thomson

    October 16, 2008 at 9:01 pm

    Awesome! Thanks for the reply! I came up with a similar line of code that was much more convoluted!

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