Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions sourceRectAtTime issue with text layer

  • sourceRectAtTime issue with text layer

    Posted by Bryan Woods on January 25, 2017 at 7:47 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?

    Dan Ebberts replied 9 years, 3 months ago 3 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    January 25, 2017 at 8:31 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

  • Bryan Woods

    January 25, 2017 at 9:19 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.

  • Emre Anil

    January 25, 2017 at 9:44 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];

  • Bryan Woods

    January 26, 2017 at 12:30 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.

  • Bryan Woods

    January 26, 2017 at 10:41 pm

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

  • Dan Ebberts

    January 26, 2017 at 10:49 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

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy