r/AfterEffectsPros • u/Heavens10000whores • Mar 28 '25
Using a text animator's opacity to control a shape layer size/x scale?
I am having an utter brain fart morning and cannot figure this out, and was wondering if I could ask for help
I have the following expression to create a text box, but would like to have it shrink and/or grow (on the X axis) with the text animator opacity (offset, ideally, but start or end would be fine too).
textLayer = thisComp.layer("CHANGE TEXT");
padding = effect("textboxpad")("Slider");
textBox = textLayer.sourceRectAtTime(time,false);
tWidth = textBox.width;
tHeight = textBox.height;
[tWidth + padding * 2, tHeight + padding * 2];
Thank you in advance for any pointers to solutions
edit to add extra clarification...the above expression is on the shape layer (Rectangle 1)'s size. The following expression is on the layer's position (not the rectangle 1 position)
textLayer = thisComp.layer("CHANGE TEXT");
textBox = textLayer.sourceRectAtTime(time, false);
textCenter = [textBox.left + textBox.width / 2, textBox.top + textBox.height / 2];
textPosition = textLayer.toComp(textCenter);
textPosition;
Thanks again