ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Shifting position when parent layer is rotating

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Christoph MüllerShifting position when parent layer is rotating
by on Feb 12, 2015 at 5:08:11 am
Last Edited By Christoph Müller on Feb 12, 2015 at 5:19:35 am

For a puppet head turn I would like the position of eyes/nose/mouth to shift 30 pixels horizontally when the parent layer (the head) rotates 10 degrees (Y Rotation). Is this possible with an expression?

I am playing around with

p = parent.transform.yRotation;
delta = p - p.valueAtTime(0);
value - delta*-.8

but it seems only to work when I parent the position to position. No luck with position to yRotation.

Anyone knows of a straight forward expression for this?

Edit:
Actually thinking about it, it would even be nicer if it is independent of parenting. Just when a certain layer is rotating then the layer with the expression applied should move in yPosition.


Return to posts index

Walter SoykaRe: Shifting position when parent layer is rotating
by on Feb 12, 2015 at 11:39:20 am

[Christoph Müller] "Actually thinking about it, it would even be nicer if it is independent of parenting. Just when a certain layer is rotating then the layer with the expression applied should move in yPosition."

For independence of parenting, you want to get the world coordinates of a layer. Check out this thread for some advice:

https://forums.creativecow.net/thread/227/10981

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Christoph MüllerRe: Shifting position when parent layer is rotating
by on Feb 13, 2015 at 4:47:56 am

Thanks Walter for your response, but I have no clue what that is and what it could have to do with what I want to do. Sorry, I am new to this.

At the end I think when I parent an expression to another layer, then I am still parenting (?)... probably yes. So actually I don't have to make it even more complicated with world coordinates. Hopefully not.

Isn't there something like:

if comp("Puppet").layer("Head_CTRL").effect("yRotation")10
then comp("Puppet").layer("Face_CTRL").effect("yPosition")30

obviously it must be more complex than that so it works both ways, left and right + for the smaller values it would have to calculate somehow a percentage... but as said, no idea how to achieve that. :(


Return to posts index


Christoph MüllerRe: Shifting position when parent layer is rotating
by on Feb 13, 2015 at 5:09:51 am

Nevermind. It seems to work with:

temp = thisComp.layer("Head").transform.yRotation;
[-temp*3, 0]


This moves the layer 3 times the value of the yRotation. Works perfectly. Is this the best method to achieve this?


Return to posts index

Walter SoykaRe: Shifting position when parent layer is rotating
by on Feb 13, 2015 at 5:36:02 am

[Christoph Müller] "This moves the layer 3 times the value of the yRotation. Works perfectly. Is this the best method to achieve this?"

This works as long as the referenced layer is not parented to something that is also rotating. To capture the rotation of the layers parent(s) as well, you'd need to use the expression Dan shared in the thread I linked above.

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Christoph MüllerRe: Shifting position when parent layer is rotating
by on Feb 14, 2015 at 12:11:49 am

ok. Thanks for clarifying, but how would I do that?

L = thisComp.layer("Null 1");
L.toWorld(L.anchorPoint)

+

temp = thisComp.layer("Head").transform.yRotation;
[-temp*3, 0]

How would I join them?


Return to posts index

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