-
shape layer anchor point expression problem
maybe someone can figure out why this expression is not working as expected.
I set up a shape layer rectangle with expressions on the rectangle’s position and the layer’s “Transform -Anchor Point” to make the rectangle size originate from the top left corner, so as to maintain stroke width.
I wanted to be able to have the same shape size from the top center at some point so I made these expressions to change the anchor point of the rectangle at a checkbox keyframe:
for the Rectangle’s Position:var CornerX = content(“Rectangle 1”).content(“Rectangle Path 1”).size[0]/2;
var CornerY = content(“Rectangle 1”).content(“Rectangle Path 1”).size[1]/2;if (effect(“margin”)(“Checkbox”) == true)
[CornerX, CornerY]
else
[ value[0] ,CornerY ]for the Layer’s Anchor Point:
var Xscale = content(“Rectangle 1”).content(“Rectangle Path 1”).size[0];
var Yscale = content(“Rectangle 1”).content(“Rectangle Path 1”).size[1];if (effect(“margin”)(“Checkbox”) == true)
[0,0]
else
[ 0, 0]So this works as expected, when the checkbox control is checked (“true”) the rectangle will size up from top left and when un-checked it sizes from top center, only the rectangle shifts to the left around the Anchor Point of the layer. I could manually re-position the layer to stick to it’s “checked” position but I wanted to have it stick dynamically as I size the rectangle so I added this expression to the position of the layer:
var X = transform.position[0];
var Y = transform.position[1];
var Offset = content(“Rectangle 1”).content(“Rectangle Path 1”).size[0] / 2;if (effect(“margin”)(“Checkbox”) == true)
transform.position
else
[ X+ Offset, Y]This seems to work as the anchor point shifts to top center but layer stays in same position, but when I size the rectangle it continues to size from top left. If i turn off the expression the rectangle will size from top center and manually repositioning does not affect the sizing.
Is this clear to all the great minds in this forum? I thought the layer’s position was independent of the rectangle.
All this is to be able to size shape layers from different point without having to split layers.
Thanks!
Sorry, there were no replies found.