Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Anchor point vs resize Path

  • Anchor point vs resize Path

    Posted by Davide Dante on March 21, 2019 at 2:49 pm

    Hi, I am trying to resize a rectangular path via Rectangular Path > Size.

    I don’t want to use transform because the path has a stroke that would deform.

    I want the rectangle to develop not from its center but from one of its corners, so I snapped the anchor point to it and edit the path size. The problem is that this is completely ignored by AE, so that the resizing keeps happening form the center :(( any clue? I can’t seem to find a solution to this (I guess) easy problem.

    I attach a quick example screenshot, you see the anchor point.

    Ameur Jalli replied 5 years, 6 months ago 3 Members · 8 Replies
  • 8 Replies
  • Tomas Bumbulevičius

    March 21, 2019 at 5:39 pm

    Hey Davide,

    apply expression below to anchor point. This will attach anchor point to the right, but adjust the array value at the end of expression to ‘pin’ it at the side you want.

    On the other hand, if you want the stroke to scale down, just add expression to stroke width, which would reduce by the size change.

    sourceSize = thisLayer.sourceRectAtTime(time, false);
    T = sourceSize.top;
    L = sourceSize.left;
    W = sourceSize.width;
    H = sourceSize.height;
    ([L+ W,T+H/2])

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.

  • Davide Dante

    April 18, 2019 at 12:13 pm

    cool man, thanks!
    I’m trying to stick it to the left side, but I don’t quite get the logic behind the script. Can you help me out?

  • Tomas Bumbulevičius

    April 18, 2019 at 2:23 pm

    Davide, sure no problems.

    Basically, whole calculation is made in the last line. Between square brackets, there are two values, which sets anchorpoint: [X,Y]

    X – its horizontal placement, where L stands for left point of layer’s source, while W – width of the layer.
    Y – is a vertical placement, where T stands for top point of layer’s source, while H – the height of the layer.

    With that said, first array item for X (L+ W) is value calculated from left part of the source, added with full width (W). Meaning, it will set anchor point to right, horizontally.

    Now if you want it to stay on the left, just keep L alone in the last line of expression ([L ,T+H/2])

    T + H/2 in this case stands for middle of the layer (meaning, we take TOP + half of the layer height)

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.

  • Davide Dante

    May 22, 2019 at 4:24 pm

    Hi Tomas,

    sorry to bother you again! but the code doesn’t work when I set a keyframe on the content size ☹ which is actually the point of the whole thing. I really don’t get why… any clue?

    Best,

  • Tomas Bumbulevičius

    May 22, 2019 at 5:20 pm

    Hey Davide, can you please do the following:

    1. Let us know where you set a keyframe – is it on the size of rectangle shape or anywhere else?
    2. What in particular does not work?
    3. Ideally, share project file with the problematic comp.

    Cheers!

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.
    Boxer – Dynamic Text Boxes Template with a Live Preview

  • Davide Dante

    May 23, 2019 at 6:24 am

    Hi Tomas,

    of course, and thank you for your prompt response.

    The code works, but as soon as I set a keyframe on the rectangle path it doesn’t anymore: the rectangle resizes from its center as per default.

    The file attached has two boxes inside which are identical except for the keyframe mentioned above. (“BOX” even slides down at some point and I don’t know why). You can easily infer the problem by playing with the rectangle path dimensions and the timeline.

    13366_textbox.aep.zip

    Best,

  • Tomas Bumbulevičius

    May 23, 2019 at 8:02 am

    Hey Davide, thanks for the sample project.

    I reviewed it and it really behaves strangely. The most importantly, when I create new rectangle layer, set its anchor and animate rect size – it attaches without any problems.

    Accordingly, maybe you someone differently created Rectangle shape, that its attributes are missing? For example, there are no transformation group. You had an empty shape layer, and then added rectangular path – not an actual rectangle.

    With that in mind please try to use rectangle tool to draw the shape – it should solve this case.

    But yeah, that one is interesting! The difference between Rectangle Path 1 vs Rectangle 1 alone, its just procedure path, without all other attributes which has Rectangle group. Hope this helps!

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.
    Boxer – Dynamic Text Boxes Template with a Live Preview

  • Ameur Jalli

    November 1, 2020 at 6:21 am

    man you explanation is really on point ! the expression worked just fine and the rectangle shape resize according to the anchor point ( I used to use animation composer anchor point marker but it only works when scaling)

    your expression is really a life saver

    thanks a lot mate

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