Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Anchor Point restrained to scale value

  • Anchor Point restrained to scale value

    Posted by Carl Gunness on July 26, 2010 at 6:20 am

    Hi All,

    I have a square shape that is animated with scale in both the X and Y unlinked positions and I would like my second layer to move with the edge of the square without scaling.

    I have tried parenting the anchor point to the scale values and the layer moves to a different position or invert scales on a unlined X or Y Value.

    Can someone please help me with this as I get a bit lost with expressions?

    Christian Labuska replied 16 years ago 3 Members · 4 Replies
  • 4 Replies
  • Kevin Camp

    July 26, 2010 at 8:26 pm

    something like this in the position property will attach the layer to the left edge of the ‘square’ layer:

    target=thisComp.layer(“Square”); // change this to your square shaped layer
    target.position – [target.width*.5*target.scale[0]/100+width*.5*scale[0]/100, 0]

    changing the – to a + will attach it to the right edge.

    it will adjust for both the scale of the square layer and the scale of the layer that it is applied to. it will need the square layer to be the width of the layer, so a masked layer or a shape layer may not work as expected, since the actual width of the layer may differ from masked area.

    is this what you are looking for?

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Carl Gunness

    July 26, 2010 at 10:25 pm

    Kevin

    Thank you so much for your reply. I didn’t think of using the position property of the layer boundaries. I had two questions.

    Scaling in X works fine. But in Y. the layer doesn’t move with the scaling. Is there a way of approximating the general position of the layer to match the decaling of the boundary area?

    How do you use the top and bottom boondies? is it a -+ +-?

    What I’m trying to ultimately achieve is a square with multiple line coming out of the square, 1:1 ratio. The square will then scale up to match a image size, say 16:9. I would like the lines to move with the scale and not change size.
    Once again thank you for the reply.

  • Kevin Camp

    July 27, 2010 at 4:32 am

    to attach a layer to the top or bottom you would just change it like this:

    target=thisComp.layer(“Square”); // change this to your square shaped layer
    target.position – [0, target.height*.5*target.scale[1]/100+height*.5*scale[1]/100]

    again change the – to a + to change top or bottom.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Christian Labuska

    July 30, 2010 at 9:04 am

    hi kevin,
    trying to do the same, but with several layers. so i’ve put this in:
    target=thisComp.layer(index-1);

    target.position + [target.width*.5*target.scale[0]/100+width*.5*scale[0]/100, 0]

    the problem is, that the layers always move from the scaling layer to the right.
    i would like them to move from the scaling layer to both sides the same way.

    so i’ ve put it in like this:

    target_up=thisComp.layer(index-1);
    target_down=thisComp.layer(index+1);
    a=target_up.width/2*target_up.scale[0]/100;
    b=-target_down.width/2*target_down.scale[0]/100;

    works fine for three layers, but i have about 30-50 layers.

    thanks a lot for the help.

    christian

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