Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions sourcerectattime not working for a specific time

  • sourcerectattime not working for a specific time

  • Adam Greenberg

    May 6, 2021 at 6:14 pm

    Hi, I have an expression that is working perfectly except for the fact that my title is animated in at the beginning ( in scale, position, and blur ). I thought I correctly identified the time to be 2 seconds so that any animation before or after would be disregarded, but its not working. I cannot figure out my error. Thanks for any help.


    L = thisComp.layer(“TITLE”);

    M = thisComp.layer(“DATE”);

    rect = L.sourceRectAtTime(2,true);

    rv = M.sourceRectAtTime(2,true);

    x = L.toComp([rect.left+rect.width,0])[0];

    y = M.toComp([rv.left+rv.width,0])[0];



    if (x>y) xclamp+gap;

    else yclamp+gap

  • Adam Greenberg

    May 6, 2021 at 6:52 pm

    Sorry. First line was missing.


  • Andrei Popa

    May 7, 2021 at 6:49 am

    Try to use rect = L.sourceRectAtTime(L.sourceTime(2),true); I had the same problem if the layer was moved forward or backward in the timeline.

  • Adam Greenberg

    May 7, 2021 at 3:47 pm

    Hmm. It’s not working. It’s still animated

  • Adam Greenberg

    May 7, 2021 at 3:52 pm

    I tested something. I added a new variable s with


    I Tested the value at s and it is constant.

    but when I replace 2 with s in the expression, it still doesn’t work. It’s still animating the value. So the problem must be the way L is defined. Can I make L look at the title layer but only at a specific time. I tried to write it and rewrite it and I cannot figure it out.

    There must be a way for me to define L as this comp layer title but only at time s.


  • Tomas Bumbulevičius

    May 7, 2021 at 5:01 pm

    Just an idea – see if inPoint of a layer you are timing to, matches the start time of composition. If not – try to take that difference into account .

  • Adam Greenberg

    May 7, 2021 at 5:22 pm

    I was thinking that also, until I replaced 2 with 200 and got the exact same result which means the time part of my expression is not affecting it at all.

    I can only guess that the definition of L needs a fixed time associated with it because even thought rect is well defined, the L must be looking at the text layer at every frame. It’s so frustrating knowing that the logic is there but I’m missing a command that I dont yet understand. some sort of value at time. I guess in the meantime I will duplicate my text layers, mute them, expression them to the source text of the real layers, remove all key frames from them, and add a correction slider in case one day a user goes in and plays with the character settings of that layer which would change the math a little.

  • Dan Ebberts

    May 8, 2021 at 12:19 am

    Animating the position or scale shouldn’t affect sourceRectAtTime(). What will affect your result though, is the time parameter of toComp(). See if doing it this way helps:

    x = L.toComp([rect.left+rect.width,0],2)[0];


    y = M.toComp([rv.left+rv.width,0],2)[0];

  • Adam Greenberg

    May 10, 2021 at 2:07 pm

    Thanks so much Dan. I had no idea there was a time parameter in the tocomp. Makes total sense once you know that, and impossible to solve if you don’t.

    Have a great week. Thanks again.

Viewing 1 - 9 of 9 posts

Log in to reply.

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