Skip to main content
Participant
Jan 22, 2024 3:14 PM UTC
Question

Link Layer to Resizable Shape

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 is closed to new replies. Start a new post to keep the conversation going.

7 replies

Community Expert
Jan 22, 2024 6:31 PM UTC

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.

 

Translate
Adam24585301qycn
Inspiring
Jan 22, 2024 3:59 PM UTC

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 ?

Translate
Participant
Jan 22, 2024 4:02 PM UTC

Yes indeed!

Translate
Adam24585301qycn
Inspiring
Jan 22, 2024 4:13 PM UTC

is it aligned at the bottom or is like touching only at the corner ( like a diagonal ) , can you render out a jpeg of a rough example of the placement, i should be bale to figure something out for you

Translate