Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expression syntax help

  • Expression syntax help

    Posted by Eric Goldstein on August 20, 2008 at 8:10 pm

    Hi,

    I’m using this expression:

    thisComp.layer(“Rotating Lens Part”).transform.zRotation

    to rotate one layer based on the rotation of another.

    But, I have to subtract 88.7 from the layer being controlled to make it line up properly. So I used this expression:

    thisComp.layer(“Rotating Lens Part”).transform.zRotation+88.7

    This worked. But I also want to multiply the result by .81 to gear the rotation down on the layer being controlled. I haven’t been able to figure out the right use of parenthesis or whatever to do this.

    Thanks for your help,

    Eric

    Darby Edelen replied 17 years, 9 months ago 3 Members · 6 Replies
  • 6 Replies
  • Lloyd Alvarez

    August 20, 2008 at 9:22 pm

    Hey Eric,

    You use parenthesis to group your calculations, so in your case it would go like this:

    ( thisComp.layer(“Rotating Lens Part”).transform.zRotation+88.7 ) * .81

    and just to further explain it, if you wanted to the divide that result by 2+2 you would do it like this:

    ( ( thisComp.layer(“Rotating Lens Part”).transform.zRotation+88.7 ) * .81 ) / (2+2)

    Hope that makes sense.. also there’s a forum for expressions.. you should find the link on the menu at the top of this page.

    -Lloyd

    https://aescripts.com

  • Eric Goldstein

    August 20, 2008 at 9:48 pm

    Hi Lloyd,

    That’s just what I needed. I had the front parenthesis in the
    wrong place.

    Thanks,

    Eric

    Eric Goldstein
    Giraffe Film Company
    Los Angeles
    eric@giraffefilm.com

  • Eric Goldstein

    August 20, 2008 at 10:09 pm

    Hi Lloyd or any other expression gurus out there,

    I’m using this expression to move x and y positions based on
    z rotation from another layer:

    x =thisComp.layer(“Rotating Lens Part”).transform.zRotation;
    [x+300.7, x+347.7, x]

    The values added to x for x and y are offsets to place the layer in a particular position. I think I might be able to do this by adjusting the anchorpoint rather than doing this in the expression.

    Anyway, I need to reverse the negative to positive rotation coming from the controling layer in the formula. How could I do this?

    Thanks again,

    Eric

    Eric Goldstein
    Giraffe Film Company
    Los Angeles
    eric@giraffefilm.com

  • Eric Goldstein

    August 20, 2008 at 10:37 pm

    Hi Lloyd and others,

    I figured out how to reverse the direction of the rotation using a negative sign. However, I now need to refer to a different comp. One of my expressions is:

    (thisComp.layer(“Rotating Lens Part”).transform.zRotation+88.7)*.673

    I assume I replace the “thisComp” with the name of the comp I want to use. So far I haven’t been able to get AE to take what I’ve tried.

    Do I have to define the name of the Comp before referring to it? Or is there some syntax I’m not aware of? I tried using the name of the comp with and without parenthesis to replace “thisComp.” This didn’t work.

    Any help would be great.

    Thanks,

    Eric

    Eric Goldstein
    Giraffe Film Company
    Los Angeles
    eric@giraffefilm.com

  • Eric Goldstein

    August 20, 2008 at 11:42 pm

    Sorry, I feel like I’ve been having a conversation with myself. Anyway, I found the answer to my question.

    (thisComp.layer(“Rotating Lens Part”).transform.zRotation+88.7)*.673

    becomes:

    (comp(“name”).layer(“Rotating Lens Part”).transform.zRotation+88.7)*.673

    Thanks for the help,

    Eric

    Eric Goldstein
    Giraffe Film Company
    Los Angeles
    eric@giraffefilm.com

  • Darby Edelen

    August 21, 2008 at 5:51 pm

    I recommend you post in the After Effects Expressions forum in the future, you’ll probably find more help there with questions like these.

    Also I recommend that you look into the linear() function as a potentially valuable resource to use in converting values instead of arbitrary multiplication. Sometimes your method is required, but usually the linear() function is much more elegant.

    And since you’ve expressed an interest in expressions, check out this site:

    https://www.motionscript.com/

    Darby Edelen

    NVIDIA
    Santa Clara, CA

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