Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions sourceRectAtTime doesn’t properly update !?

  • sourceRectAtTime doesn’t properly update !?

    Posted by Patrick Grossien on January 20, 2016 at 6:23 pm

    So this is weird. I’m using CC2015 and sourceRectAtTime doesn’t update properly for me.

    Basically I want to fake a typing situation with the blinking cursor behind the appearing text. So I created a text layer with appearing text and wanted to stick the blinking cursor layer to the end of the text and have it move along with the appearing text.

    My text is set up so that it appears over time via an animated slider:

    n=thisComp.layer("jo******@**.com").effect("Tipp Counter")("Slider");
    showtext=text.sourceText.substr(0,n);

    Now I tried to attach the blinking cursor to the end of the appearing text.

    L = thisComp.layer("jo******@**.com");
    r = L.sourceRectAtTime(time,false);
    fromComp(L.toComp([r.left+r.width,r.top+r.height]))

    The value is not being updated over time and the cursor doesn’t move at all.
    I also checked what happens with the width of sourceRectAtTime and it doesn’t update either when used solo.

    Any insight as to what I’m doing wrong? Or is there a bug I’m missing.

    Thanks!

    David Cabestany replied 6 years, 9 months ago 4 Members · 8 Replies
  • 8 Replies
  • Todd Kopriva

    January 20, 2016 at 6:38 pm

    https://blogs.adobe.com/aftereffects/2014/12/after-effects-cc-2014-2-13-2.html

    “The values returned are calculated before effects and layer styles are applied.”

    ———————————————————————————————————
    Todd Kopriva, Adobe Systems Incorporated
    After Effects product manager and curmudgeon
    After Effects team blog
    ———————————————————————————————————

  • Dan Ebberts

    January 20, 2016 at 6:44 pm

    I’m not seeing that behavior (on CC 2015). I tried it with a slider controlling the number of characters on the text layer and sourceRectAtTime() on another layer, and the width does update for me.

  • Patrick Grossien

    January 20, 2016 at 7:28 pm

    Thank you all for your responses.

    Now I’m angry at myself, because I haven’t tried it in an empty composition. Weird enough it works fine there, too. Now I gotta figure out what’s wrong in the main comp. Still weird..

    But I’m now having another problem with that expression:

    L = thisComp.layer("john.doe@me.com");
    r = L.sourceRectAtTime(time,false);
    fromComp(L.toComp([r.left+r.width,r.top+r.height]))

    I think I’m having problems with the “fromComp” “toComp” situation. I though this would make it stick to the lower right corner of the text layer but the cursor sticks at the upper left corner of the composition. How would I set this up to make it position with the text layer?

  • Dan Ebberts

    January 20, 2016 at 8:37 pm

    I think this will give you the lower right corner of the text (assuming everything is at 100% scale):

    L = thisComp.layer(“john.doe@me.com”);
    r = L.sourceRectAtTime(time,false);
    L.toComp(L.anchorPoint)+[r.left+r.width,r.top+r.height]

    Dan

  • Patrick Grossien

    January 20, 2016 at 9:14 pm

    You’re a life safer! Thanks Dan! That’s it.

    I need to wrap my head around this whole fromComp toComp thing somehow….

  • Patrick Grossien

    January 20, 2016 at 9:30 pm

    I found out what was happening. It happens when I slide the layers over so that they start later but the animation for the blinking cursor happens at the beginning of the composition (with no active layers) and not from the point in time, when the actual layer starts. So the whole animation doesn’t offset along with the layers in points.

    I thought “time” would work at the current playhead time. Any insight to this?

    Thanks!

  • Patrick Grossien

    January 20, 2016 at 9:45 pm

    OK, I believe I got it:

    L = thisComp.layer(“john.doe@me.com”);
    inP = inPoint;
    r = L.sourceRectAtTime(time-inP,false);
    L.toComp(L.anchorPoint)+[r.left+r.width,r.top+r.height]

    I took the inPoint of the Cursor Layer and subtracted it from “time”.
    I just don’t get why I need to do that and why it needs to be subtracted and not added…

    (both layers have their inPoints at the same point in time. the actual animation of the appearing text starts a few frames after the inPoint)

  • David Cabestany

    July 30, 2019 at 8:52 pm

    Sorry to hijack your thread, but this is somewhat related.

    sourceRectAtTime works as expected when typing up the text and also if I vary the length of each line on a multi-line text layer, but if I animate the writing of the text using a text animator (typewriter, for example) it only shows the end size, the affected object does not vary its size as the text layer is growing in size.

    Your help is greatly (and urgently) appreciated.

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