Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions sourceRectAtTime() does not work with timeline offset.

  • sourceRectAtTime() does not work with timeline offset.

    Posted by Smet Kira on May 2, 2023 at 3:48 am

    Hi all. I have two animated text on animator scale with shapes that depend on the size of the text. As soon as one of these texts I shift in time, the shape does not react correctly. It reacts as if the text has not shifted in time. Can this problem be solved?

    Brie Clayton replied 3 years ago 3 Members · 3 Replies
  • 3 Replies
  • Filip Vandueren

    May 2, 2023 at 6:48 am

    Hey Kira,

    the method is looking at the “source” of the footage at a certain time.

    But the current time of the composition (which is default if you don’t give a number to .sourceRectAtTime() ) is not necessarily the current time of the source of a layer.

    So you are seeing values for sourceRect that are out of sync: the method asks what is the sourceRect of this layer at its own 1:07 time (the current time-value of the comp), and that is what’s returned, even though that is not the currently displayed frame of this textlayer.

    It’s confusing and unintuitive because for shape, solid, stills and text layers we’re not as aware of the actual inpoint and internal time of those layers as we are with a video or precomp.

    Here is the fix:

    l=thisComp.layer(index-1);
    sr=l.sourceRectAtTime(l.sourceTime(time));

    Now sr holds the sourceRect of the layer as we now see it. The l.sourceTime(time) method has figured out what time of the layer’s source is currently being displayed for us.

  • Smet Kira

    May 2, 2023 at 7:56 am

    Thx Filip! You awesome!

    I searched for a long time on the Internet, I could not find it.

  • Brie Clayton

    May 2, 2023 at 5:48 pm

    Thank you for your solve, Filip!

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