Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Change Size of Shape Layer based on Text Layer

Community Beginner ,
Sep 21, 2017 Sep 21, 2017

Hey guys,

I'm looking for an expression (preferably) to change the width of a plain ol' black rectangular box that's sitting beneath a layer of text. The text layer is going to change length, and I therefore need the black box to adjust with the text and change length accordingly. I'm sure there's a simple way to do this, but I've been fighting a cold all week and my brain is a little fried.

Any suggestions?

10.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 21, 2017 Sep 21, 2017

There's a (relatively new) expression function that does exactly this: "sourceRectAtTime"
SourceRectAtTime() Expression- Adobe After Effects tutorial - YouTube

Translate
Community Expert ,
Sep 21, 2017 Sep 21, 2017

There's a (relatively new) expression function that does exactly this: "sourceRectAtTime"
SourceRectAtTime() Expression- Adobe After Effects tutorial - YouTube

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 21, 2017 Sep 21, 2017
LATEST

Hi Kyle,

Thanks! Your link was helpful. This is what I ended up with:

theTextLayer = thisComp.layer("TEXT");

p = 50;

box = theTextLayer.sourceRectAtTime(time);

x = box.width + (p*2);

y = 150;

[x,y]

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines