ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Help! Transposing Anchor Point and Position

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Lu Nelson
Help! Transposing Anchor Point and Position
on Jan 10, 2009 at 1:20:04 pm

offset1=(thisComp.width/2-transform.position[0])/transform.scale[0]*100*thisComp.pixelAspect;
offset2=(thisComp.height/2-transform.position[1])/transform.scale[1]*100;
[(value[0]-offset1), (value[1]-offset2)]


OK, I tried to work this out on paper and somehow got the opposite of what I intended.

If you paste the following code in to the Anchor Point property of a layer, and then try to move the layer around the comp with the arrow cursor, the layer stays in the centre and the anchor point moves instead.

What I wanted was the opposite: to be able to move the layer and have the anchor point stay in the middle of the comp. I'm approaching it backwards somehow.

Can anyone untangle this for me?


Return to posts index

Dan Ebberts
Re: Help! Transposing Anchor Point and Position
on Jan 10, 2009 at 4:08:27 pm

That's a tricky one. The position and anchor point values aren't independent as you can see when you use the pan behind tool. I'd be interested to see if somebody has cracked this one.

What are you trying to do? Could you do it just as easily by parenting the layer to a null?

Dan



Return to posts index

Elad Menashe
Re: Help! Transposing Anchor Point and Position
on Jan 13, 2009 at 9:16:45 pm

You cannot change both the position and the anchor point using expressions since you need the anchor point value to be affected by the position value before its expression value was evaluated, you can do the following to achieve your goal:
1) Create a null layer and make it the parent of your layer.
2) apply this code to the null's position:
value - thisComp.layer("White Solid 1").transform.position
3) apply this code to your layer's anchor point:
value - transform.position
4) Hide the null layer.

Regards
Elad


Return to posts index

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