(1)形状图层与文字层子父链接
(2)形状图层---Rectangle Path---size
margin=70;
text_width=thisComp.layer("文本").sourceRectAtTime().width;
text_height=thisComp.layer("文本").sourceRectAtTime().height;
box_width=text_width+margin*2;
box_height=text_height+margin*2;
[box_width,box_height]
(3)形状图层---Transform:Rectangle---position
t=thisComp.layer("文本");
tRect=t.sourceRectAtTime(time,false);
tUL=t.toComp([tRect.left,tRect.top]);
tLR=t.toComp([tRect.left+tRect.width,tRect.top+tRect.height]);
tCenter=(tUL+tLR)/2
myRect=sourceRectAtTime(time,false);
myUL=toComp([myRect.left,myRect.top]);
myLR=toComp([myRect.left+myRect.width,myRect.top+myRect.height]);
myCenter=(myUL+myLR)/2
delta=myCenter-tCenter;
value-delta
最终效果: