FORUMS: list search recent posts

# Anchor point vs resize Path

FAQ   •   VIEW ALL
 Anchor point vs resize Path on Mar 21, 2019 at 2:49:41 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.

 Re: Anchor point vs resize Pathon Mar 21, 2019 at 5:39:03 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.

 Re: Anchor point vs resize Pathon Apr 18, 2019 at 12:13:25 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?

 Re: Anchor point vs resize Pathon Apr 18, 2019 at 2:23:48 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.

 Re: Anchor point vs resize Pathon May 22, 2019 at 4:24:31 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,

 Re: Anchor point vs resize Pathon May 22, 2019 at 5:20:19 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

 Re: Anchor point vs resize Pathon May 23, 2019 at 6:24:35 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,

 Re: Anchor point vs resize Pathon May 23, 2019 at 8:02:00 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