Skip to main content
Participant
January 22, 2024
Question

Link Layer to Resizable Shape

  • January 22, 2024
  • 2 replies
  • 713 views

Hi all,

I'm working on a motion graphic template where I have a rectangle I'd like to resize. I've used two slider controls for this. On the rectangle's size parameter, we have:

Width = thisComp.layer("Full Lower Third").effect("Box Width")("Slider");
Height = thisComp.layer("Full Lower Third").effect("Box Height")("Slider");

[Width, Height]

I'm also using a workaround from YouTube to be able to resize this rectangle from the top left corner as if I had moved an anchor point there. On the rectangle's anchor point:

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

This works perfrectly. 

I have another shape layer that needs to stay aligned to the right hand edge of the rectangle as it resizes, but I've tried everything I know to get this to work. The layer always moves at a different rate to the right hand edge of the rectangle and I haven't managed to get this to work together. I can't use scale properties as it will mess with the proportions of the shapes!

Windows, After Effects 24.0

Cheers!

This topic has been closed for replies.

2 replies

Community Expert
January 22, 2024

To resize a shape layer from the corners, you need to reposition the Shape/Transform Shape/Anchor point to the corner you want to use. If there is only one shape on the layer, this is easiest to accomplish if the Shape/Position is 0, 0 and the Shape/Transform Shape position is also 0, 0, so the Shape Layer Anchor point is in the center of the rectangle. If I were creating a MOGRT (Essential Graphics Workspace), I would add a menu control and this expression to the Contents/Rectangle1/Transform Rectangle 1/Anchor point.

ctrl = effect("Dropdown Menu Control")("Menu");
box = content("Rectangle 1").content("Rectangle Path 1").size/2;
if (ctrl == 1)
	a = -box;
else if (ctrl == 2)
	a = [box[0], - box[1]];
else if (ctrl == 3)
	a = box;
else if (ctrl == 4)
	a = [-box[0], box[1]]
else if (ctrl == 5)
	a = [0, 0]

The Menu Control labels would be Top Left, Top Right, Bottom Right, Bottom Left, and Center.

 

Adam24585301qycn
Inspiring
January 22, 2024

do you need the second layer to follow the right edge of the first rectangle but not resize when you resize the first shape ?

is this what you want ?

Participant
January 22, 2024

Yes indeed!

Adam24585301qycn
Inspiring
January 22, 2024

I might be on to something, let me follow this thread and if it fails, I'll get some more detail so I can show you what I'm working on better. 

Thanks for you help!


ok, im 100% its doable