Skip to main content
Participant
December 27, 2021
Question

Why is the anchor point completely disregarded when sizing shapes?

  • December 27, 2021
  • 3 replies
  • 200 views

I've moved the shape layer's anchor point as well as the rectangle's anchor point, and when I try to change the size, it still sizes from the center. Please help! I've attached a screen recording.

I'm using size instead of scale, because I need to keep the roundness the same size and scale, well, scales it down. If anyone has any recommendations on how else to do this, please let me know!

This topic has been closed for replies.

3 replies

Community Expert
December 28, 2021

Each object in a shape layer has its own transform properties. Shape Layer 1/Contents/Rectangle 1 has Transform Rectangle 1 properties, including anchor point. If you write a simple expression that retrieves the rectangle size and divide that by two, you can position the Rectangle anchor point on any edge of the shape and make any edge or corner stay put by simply modifying the expression. Here's the expression for putting the Rectangle 1/Transform Rectangle 1 anchor point at the bottom center of the rectangle:

 

recSize = content("Rectangle 1").content("Rectangle Path 1").size / 2;
[0, recSize[1]]

 

That gives you this:

Change the expression to this and you get the Transform Rectangle 1/Anchor point at the top right corner:

 

recSize = content("Rectangle 1").content("Rectangle Path 1").size / 2;
[-recSize[0], -recSize[1]]

 

 

You can then use either the Shape Layer 1/Contents/Rectangle 1/Rectangle Path 1/Position or the Layer or the Shape Layer 1/Contents/Rectangle 1/Transform Rectangle 1/Position to place Rectangle 1 anywhere you want to in the comp.

 

I have an animation preset with a drop-down Effects Controller that lets me set the Transform Shape anchor point on the corners and the middle of each edge. It just uses 9 if/else statements. The basic expression looks like this:

posCtrl = effect("Positin Control")("Menu");
recSize = content("Rectangle 1").content("Rectangle Path 1").size / 2;
if(posCtrl == 1){
	ap = [- recSize[0], - recSize[1]];
}
else if(posCtrl == 2){
	ap = [0, - recSize[1]];
}
else if(posCtrl == 3){
	ap = [recSize[0], - recSize[1]];
}
else if(posCtrl == 4){
	ap = [recSize[0], 0];
}
else if(posCtrl == 5){
	ap = [recSize[0], recSize[1]];
}
else if(posCtrl == 6){
	ap = [0, recSize[1]];
}
else if(posCtrl == 7){
	ap = [- recSize[0], recSize[1]];
}
else if(posCtrl == 8){
	ap = [- recSize[0], 0];
}
else if(posCtrl == 9){
	ap = [0, 0];
}

One of these days, I'll redo the definition of recSize to use property groups so I can add the expression to any shape and have it work. 

 

I hope this gives you some help with your design problem. 

Jose Panadero
Community Expert
Community Expert
December 27, 2021

If you change the size of a shape inside a shape layer, their size will always be scaled from the shape's center. All shapes have their own Transform category, where you can change their anchor point. If you modifiy the anchor point and then the own scale property for any shape then it will be scaled based on their anchor point. 

 

If you modify the layer's anchor point then you must use the layer's scale to create your transformations respecting the layer's anchor point.

 

This is the way AE work.

 

autpopsAuthor
Participant
December 27, 2021

Here's a Vimeo link if that's easier: https://vimeo.com/660507201/21842dad02

I should add that I need to shorten the rectangle, and scaling warps the rounded corners. I've tried null objects, using add > rounded corners, but the squish scale effect applies to these methods as well and I need the corners to keep their shape.