Activity › Forums › Adobe After Effects Expressions › How to link X rotation in one layer to X rotation in another?
-
How to link X rotation in one layer to X rotation in another?
Posted by Eric Goldstein on July 30, 2011 at 11:26 pmHi,
I’d like to link (parent) X rotation in one layer with X rotation in another layer and possibly put a slider control on the child layer to lessen or increase the effect. Can someone advise me on how to do this?
Thanks,
Eric
Eric Goldstein
Giraffe Film Company
Los Angeles
er**@*********lm.comEric Goldstein replied 14 years, 9 months ago 2 Members · 4 Replies -
4 Replies
-
Dan Ebberts
July 31, 2011 at 1:25 amIt depends on exactly what you have in mind. If you just want Layer 2’s x rotation to be some multiple (or fraction) of Layer 1’s, it could look like this:
m = effect(“Slider Control”)(“Slider”);
thisComp.layer(“layer 1”).transform.xRotation*mIf you wanted Layer 2’s x rotation to be offset by some fraction of Layer 1’s x rotation change since time zero, it could look like this:
m = effect(“Slider Control”)(“Slider”);
r = thisComp.layer(“layer 1”).transform.xRotation;
value + (r – r.valueAtTime(0))*mDan
-
Eric Goldstein
July 31, 2011 at 2:16 amHi Dan,
Thank you for your help. But, could you elaborate on your answer. I’m new to expressions. Would I place the formula in the “child” layer’s X rotation? Would I place the slider on this same layer? How do I hook the slider into the formula and how do reference the “parent” layer?
Thanks,
Eric
Eric Goldstein
Giraffe Film Company
Los Angeles
eric@giraffefilm.com -
Dan Ebberts
July 31, 2011 at 6:05 am>Would I place the formula in the “child” layer’s X rotation?
Yes.
>Would I place the slider on this same layer?
Yes.
>How do I hook the slider into the formula?
m = effect(“Slider Control”)(“Slider”);
>how do reference the “parent” layer?
thisComp.layer(“parent layer name goes here”).transform.xRotation
Unless you actually have the two layers parented together, in which case you could just use parent.transform.xRotation, but in that case you probably wouldn’t use this expression anyway.
Dan
-
Eric Goldstein
July 31, 2011 at 3:10 pmHi Dan,
Thank you for your help. I got the expression to work to some extent, but for some reason it rotated the layers I was working with 180 degrees perpendicular to the axis I was working on. And the slider was extremely sensitive making very big movements for small incremental changes. I want to learn more about expressions, but I always run into the problem of time.
In the end, I did it the old fashioned way put the same keyframes from the “parent” layer into the “child.” But, I do want to learn more about expressions.
Thanks again for your help.
Eric
Eric Goldstein
Giraffe Film Company
Los Angeles
eric@giraffefilm.com
Reply to this Discussion! Login or Sign Up