• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Center Anchor Point for Contents within Shape Layer

New Here ,
Jul 18, 2022 Jul 18, 2022

Copy link to clipboard

Copied

I haven't found an answer to this anywhere. I am not sure if it is even possible. 

 

I need to know how to center the anchor point of a single shape within a shape layer. 

 

I am trying to rotate a couple of shapes within a single shape layer, but I cannot figure out how to get their anchor points centered. I know how to do it for the entire layer, but not for the contents within the layer. 

 

AE Senter Anchor point.jpg

TOPICS
FAQ , How to

Views

8.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 18, 2022 Jul 18, 2022

Copy link to clipboard

Copied

You can do it manually by using the Pan Behind Tool.

With the shape selected activate the Pan Behind Tool (Y) and you can drag the anchor point of the shape wherever you like.

You could also open the Transform properties of the shape (it will say Transform: Shape name) and reset Anchor Point to 0, 0. But then you will proably have to adjust the shapes position when it shifts.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 18, 2022 Jul 18, 2022

Copy link to clipboard

Copied

Is there a way to get the anchor point to snap to the exact middle of the shape? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 18, 2022 Jul 18, 2022

Copy link to clipboard

Copied

Unfortunately I don't know a way of snapping the Anchor Point to the middle automatically while dragging it. Every snapping option I am familiar with in AE works at the layer level.
Resetting the anchor point back to 0, 0 in the shape layer transform would do it but it will also shift the shape position.

Now that I think of it, it might be possible with an expression to compensate for the shape position.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 03, 2022 Nov 03, 2022

Copy link to clipboard

Copied

There is a shortcut to this, right click shape > Transform > Center anchor point or somthing like this text.

you can also change it's shortcut to quick apply

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 28, 2023 Nov 28, 2023

Copy link to clipboard

Copied

LATEST

That doesn't actually work. Transform is a layer level command, not a shape level one.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 18, 2022 Jul 18, 2022

Copy link to clipboard

Copied

Parametric shapes are easy. Press the U key twice and reset the Contents/Rectangle/Transform Rectangle property to 0,0. 

 

Paths are a different problem. If you reset the anchor point, the layer will move because the position will not automatically change like it does when using the "y" Pan Behind tool. You can use an expression to center the anchor point on any shape layer by using sourceRectAtTime(). Left will give you the left edge, and the width will provide you with the width, so half the width + the left will give you the center. Top will give you the distance from the layer's anchor point, and height will give you the height. 

 

Apply this expression to shape layers Anchor Point:

 

 

 

ref = sourceRectAtTime();
w = ref.width/2;
h = ref.height/2;
l = ref.left;
t = ref.top;

[w + l, h + t]

 

 

 

That will center any path or parametric shape on the Shape layer's Anchor Point. If you have more than one shape on the layer, it will center the entire group. Only the Anchor Point will change, and the shape layer contents will be repositioned. 

 

Unfortunately, sourceRectAtTime() does not take stroke width into account. As long as you have a closed path,  the anchor point will be in the center of the shape, but if you have a C-shaped or U-shaped path, the anchor point will be off by half the stroke width. 

 

You can use a similar approach with slightly different modifications to the expression to position the Shape Transform anchor point of a shape in the Contents section of a Shape layer so you can scale, rotate or skew from any corner or the middle of any side. I use this expression all the time. This is the one I have stored as an animation preset. It requires adding a Dropdown Menu Control and naming it Anchor Point Control, and adding nine menu items. It will work on any layer.

 

 

ref = sourceRectAtTime();
w = ref.width;
h = ref.height;
l = ref.left;
t = ref.top;
ctrl = effect("Anchor Point Control")("Menu");

if (ctrl == 1)
	[l + w / 2, t + h / 2];
else if (ctrl == 2)
	[l, t];
else if (ctrl == 3)
	[l + w / 2, t];
else if (ctrl == 4)
	[l + w, t];
else if (ctrl == 5)
	[l + w, t + h / 2];
else if (ctrl == 6)
	[l + w, t + h];
else if (ctrl == 7)
	[l + w / 2, t + h];
else if (ctrl == 8)
	[l, t + h];
else if (ctrl == 9)
	[l, t + h / 2]

 

 

I use it often. It is probably one of my top 10 Animation Presets.

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 03, 2022 Nov 03, 2022

Copy link to clipboard

Copied

This script will do what you want: https://blob.pureandapplied.com.au/a-content-centric-model-of-the-universe/ (put it on KBAR)

Putting an expression on is not really time efficient and complicates things if you are doing it for work e.g. creating a simple 2 line crosshair on one layer would take you ages.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2022 Nov 03, 2022

Copy link to clipboard

Copied

That's why you create animation presets. When you are familiar with expressions and animation presets, all you have to do is select and click. The advantage of a script is that it can create more than one layer. It took about 15 minutes to create an animation preset that creates crosshairs with a single Shape layer, centers the crosshairs over the Anchor Point of the layer below, and allows you to adjust the width, length, and color of the crosshairs as well as a gap with expression control sliders. It even allows you to add a circle. 

 

If you want to try it, here it is:
 https://www.dropbox.com/s/7ts7fhxnji0lcv0/Cross%20Hairs.ffx?dl=0

RickGerard_1-1667478906857.gif

Most of the work was just a simple copy and paste of a basic expression for shape position, then some duplicate contents in the shape layer. If you want to be efficient, take the time to learn expressions. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 28, 2023 Nov 28, 2023

Copy link to clipboard

Copied

This seems like an awefully simple thing to want to do, but for some reason is impossible without needing lengthy expressions. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines