ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

sourceRectAtTime issue with text layer

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Bryan Woods
sourceRectAtTime issue with text layer
on Jan 25, 2017 at 7:47:38 pm

Trying to line up a beam effect with the left center and right center of a text layer, but I'm not getting what I'm expecting.

As an example, in the beam's start point, I've put in:
[thisLayer.sourceRectAtTime(time,true).left,thisLayer.sourceRectAtTime(time,true).height/2]

This however sends the beam start point way out to the left of the text layer and a bit up from it. Clearly I don't know enough about sourceRectAtTime to use this properly. What am I doing wrong here?


Return to posts index

Dan Ebberts
Re: sourceRectAtTime issue with text layer
on Jan 25, 2017 at 8:31:03 pm

Try these:

// Starting Point
r = sourceRectAtTime(time,true);
toComp([r.left,r.top+r.height/2])

// Ending Point
r = sourceRectAtTime(time,true);
toComp([r.left+r.width,r.top+r.height/2])


Dan



Return to posts index

Bryan Woods
Re: sourceRectAtTime issue with text layer
on Jan 25, 2017 at 9:19:09 pm

Thanks Dan. I'm also trying to link the beam's starting thickness to the distance of the layer's parent position, relative to the camera.

I've got this working in the beam's start thickness parameter:
p1 = thisLayer.parent.position[2];
p2 = thisComp.activeCamera.position;

value+length(p1, p2);


but I notice as the layer moves in z towards the camera, the thickness decreases, and visa versa, when it should be the other way around. I thought I could invert the result by multiplying by -1, but that doesn't seem to be doing anything.


Return to posts index


Emre Anil
Re: sourceRectAtTime issue with text layer
on Jan 25, 2017 at 9:44:01 pm

If you're trying to assign the distance in Z-axis only, add "[2]" to your camera position too.

You might need to control the Min/Max values for the thickness tough.

p1 = thisLayer.parent.position[2];
p2 = thisComp.activeCamera.position[2];


Return to posts index

Bryan Woods
Re: sourceRectAtTime issue with text layer
on Jan 26, 2017 at 12:30:50 am

The problem I'm having is that i'm getting the inverse of the thickness. As I move the layer closer in Z, the thickness shrinks, and visa versa. I need to get the inverse result.


Return to posts index

Bryan Woods
Re: sourceRectAtTime issue with text layer
on Jan 26, 2017 at 10:41:34 pm

No ideas how to get the inverse of the linear function?


Return to posts index


Dan Ebberts
Re: sourceRectAtTime issue with text layer
on Jan 26, 2017 at 10:49:15 pm

I'm guessing you need to define some reference points. For example, minimum width occurs at this distance, maximum width occurs at this distance.


Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]