Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Problem when using SourceRectAtTime expression

  • Problem when using SourceRectAtTime expression

    Posted by Ken Kwong on June 20, 2019 at 9:57 pm

    Hi, I am using the SourceRectAtTime() Expression sample from ECAbrams to have a rectangle shape layer resizes itself according to a text layer’s height and width. It’s working nicely.

    s=thisComp.layer("HELLO");
    x=s.sourceRectAtTime(time-s.inPoint,true).width;
    y=s.sourceRectAtTime(time-s.inPoint,true).height;
    [x,y]

    Then I realized the “timing” is based on the layer time but not the comp time (which is solved by using time-inPoint)

    But after that, I also realized SourceRectAtTime starts counting from the “initial starting point” of the text layer, which means when I extend or reduce the text layer’s starting point, the inPoint is looking at the altered starting point, but the SourceRectAtTime is looking at the initial starting point of the text layer. That makes the timing “off”

    So I am thinking if there’s anything that can replace time-inPoint, so we can get the “initial starting point” which matches the SourceRectAtTime. But no luck yet…

    Any help on this will be greatly appreciated!

    Ken Kwong replied 7 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Oleg Pirogov

    June 21, 2019 at 6:19 am

    >if there’s anything that can replace time-inPoint, so we can get the “initial starting point”
    Threre’s startTime.
    Just put it in place of inPoint, that should get you what you’re looking for.

  • Ken Kwong

    June 28, 2019 at 2:18 am

    Simple, direct, and it works perfectly!
    Thanks a lot and this makes me think all the tutorials teach people to use inPoint for SourceRectatTime should correct it…

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