A simple stack of effects.
Here's a simple but effective technique to rig a background box to fit to a dynamic text layer.
I've always done this with expressions (which is still a more powerful and flexible solution), but for simple use and fast use cases, this thread by JC Tecklenburg is GOLD.
by JC Tecklenburg
How does this work?
Shift Channels - "Set Alpha From" to "Full On", makes anything within the layer's bounds fully opaque. The text layer is completely filled in.
CC Repetile extends the edges of a layer by mirroring or tiling to add padding to the box.
The Fill effect, fills all of the opaque areas of the layer with a color.
CC Composite composites the original layer back on top of the stack of effects. So it grabs the original text (with normal transparency) and plops it back over our new background.
ou can add a Simple Choker between CC Repetile and CC Composite to give a quick, hacky rounded corner effect.
Get weekly After Effects tips
delivered to your inbox