Adobe After Effects Expressions Forum
Problem when using SourceRectAtTime expression
Problem when using SourceRectAtTime expression
by Ken Kwong on Jun 20, 2019 at 9:57:11 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!




Re: Problem when using SourceRectAtTime expression
by Oleg Pirogov on Jun 21, 2019 at 6:19:40 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.


Re: Problem when using SourceRectAtTime expression
by Ken Kwong on Jun 28, 2019 at 2:18:07 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...





© CreativeCOW.net