Mailing List AE-List@media-motion.tv — Message #64777
From: Dan Ebberts <AE-List@media-motion.tv>
Subject: RE: [AE] sourceRectAtTime() on 3D layers
Date: Wed, 16 Jan 2019 13:11:56 -0800
To: 'After Effects Mail List' <AE-List@media-motion.tv>

Depending on what's happening in your comp, your corner values, derived from toComp() could be changing. Again depending on what you're doing, toWorld() might work better.

 

Dan

 

From: After Effects Mail List <AE-List@media-motion.tv>
Sent: Wednesday, January 16, 2019 12:46 PM
To: After Effects Mail List <AE-List@media-motion.tv>
Subject: [AE] sourceRectAtTime() on 3D layers

 

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]

 
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to ListMaster