Expression n.7 circle.Fits.Text
explainer:
bit.ly/4fzEoEV
This expression pair automatically adjusts the scale and position of a circular shape layer to fit a text layer’s bounding box. Ideal for creating dynamically adjusting backgrounds or highlight circles, it keeps the shape layer centered and proportionate to the text’s dimensions, even when the text size changes.
Apply on Shape Layer Scale Property:
var textLayer = thisComp.layer(“TextLayer”);
var textRect = textLayer.sourceRectAtTime(time, false);
var padding = 20;
var circleDiameter = Math.max(textRect.width, textRect.height) + padding * 2;
var circleSize = thisLayer.content(“Ellipse 1”).content(“Ellipse Path 1”).size[0];
var scaleValue = (circleDiameter / circleSize) * 100;
[scaleValue, scaleValue];
Apply on Shape Layer Position Property:
var textLayer = thisComp.layer(“TextLayer”);
var textRect = textLayer.sourceRectAtTime(time, false);
var textCenter = [textRect.left + textRect.width / 2,
textRect.top + textRect...