Well. Baby steps. So you have a rectangle on a text layer. Then another text layer comes in and you want it to take the size of the new text? If so, you should use an ease function. Something like this
dur = 0.33; //about ten frames, assuming that you are working on a 30 fps project
easeStart = thisComp.layer("secondTextLayer").inPoint;
easeEnd = easeStart + dur;
startValue = [thisComp.layer("firstTextLayer").sourceRectAtTime(time,false).width,thisComp.layer("firstTextLayer").sourceRectAtTime(time,false).height]
endValue = [thisComp.layer("secondTextLayer").sourceRectAtTime(time,false).width,thisComp.layer("secondTextLayer").sourceRectAtTime(time,false).height]
if (time< easeStart) startValue else ease(time,easeStart,easeEnd,startValue,endValue);
this is for 2 layers. If you have many, i would suggest arranging them one after another and using the index in a for loop. If you do have many layers and can’t figure this out, tell me and i will try to find a solution.
Andrei