I have a null that is being scaled by a text layer's bounding box. It's working fine in 2D space. However I just changed the layers to 3D and tried to animate and I'm getting some problems. I am trying to use a marker to tell it when to pull the sourceRect. I've put that marker after the animation is over and the text is squared up. However, as the text moves I'm seeing some motion on the scale values. I thought the sourceRect function was supposed to only pull from the value you supplied in the time value?
L= effect("Text layer 1")("Layer"); //layer choice comes from the drop down
tM = thisLayer.marker.key(1).time; //get the time from the marker on when to sample the bounding box
R=L.sourceRectAtTime(tM, true); //get the rect
extraScale = effect("ExtraScale")("Slider");
 //log all the corners
UL = L.toComp([R.left,R.top]);
UR = L.toComp([R.left+R.width,R.top]);
LR = L.toComp([R.left+R.width,R.top+R.height]);
LL = L.toComp([R.left,R.top+R.height]);
maxX = Math.max(UL[0],UR[0],LR[0],LL[0]);
minX = Math.min(UL[0],UR[0],LR[0],LL[0]);
maxY = Math.max(UL[1],UR[1],LR[1],LL[1]);
minY = Math.min(UL[1],UR[1],LR[1],LL[1]);
 Â
tS = (maxX-minX) / (100 / L.transform.scale[0]);
//width guide null layer
gWidth = thisComp.layer("width guide").transform.scale[0];
x = transform.scale[0];
if (tS > gWidth){ //get the parent scale if there is one
oS = tS;
}else{oS = gWidth}
o = gWidth / oS;
x = x * o ;
[x + extraScale, x + extraScale]