Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Help! Transposing Anchor Point and Position

  • Help! Transposing Anchor Point and Position

    Posted by Lu Nelson on January 10, 2009 at 1:20 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?

    Elad Menashe replied 17 years, 3 months ago 3 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    January 10, 2009 at 4:08 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

  • Elad Menashe

    January 13, 2009 at 9:16 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

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