Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE AFTER EFFECTS: HomeForumBasicsExpressionsTutorialsPodcastsMotion GraphicsTrainingCinema 4DFAQ

Expression syntax help

COW Forums : Adobe After Effects

<< PREVIOUS THREAD   •   VIEW ALL THREADS   •   PRINT   •   NEXT THREAD >>
Expression syntax help
by Eric Goldstein on Aug 20, 2008 at 8:10:19 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

Respond to this post   •   Return to posts index

Re: Expression syntax help
by Lloyd Alvarez on Aug 20, 2008 at 9:22:37 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

http://aescripts.com

Respond to this post   •   Return to posts index

Re: Expression syntax help
by Eric Goldstein on Aug 20, 2008 at 9:48:38 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

Respond to this post   •   Return to posts index


Re: Expression syntax help
by Eric Goldstein on Aug 20, 2008 at 10:09:06 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

Respond to this post   •   Return to posts index

Re: Expression syntax help
by Eric Goldstein on Aug 20, 2008 at 10:37:22 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

Respond to this post   •   Return to posts index

Re: Expression syntax help
by Eric Goldstein on Aug 20, 2008 at 11:42:28 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

Respond to this post   •   Return to posts index


Re: Expression syntax help
by Darby Edelen on Aug 21, 2008 at 5:51:42 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:

http://www.motionscript.com/

Darby Edelen

NVIDIA
Santa Clara, CA

Respond to this post   •   Return to posts index

<< PREVIOUS THREAD   •   VIEW ALL THREADS   •   PRINT   •   NEXT THREAD >>


FORUMSTUTORIALSMAGAZINETRAININGVIDEOS - REELSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]