ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

sourceRectAtTime individual group within layer

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Thomas Collier
sourceRectAtTime individual group within layer
on Jun 24, 2020 at 9:21:46 pm

What is the proper syntax after thisLayer to access individual content groups or paths within a shape layer?

I know how to use sourceRectAtTime to obtain the overall dimensions of a layer, but is it possible to use it to access an individual group of layers within a shape layer? My issue is I have two groups, with multiple shapes beneath each. I want to center my anchor point on only one of the groups. However I am unable to pickwhip any of the contents of my shape layer.

w = thisLayer.sourceRectAtTime(time,false).width;
h = thisLayer.sourceRectAtTime(time,false).height/2;
t = thisLayer.sourceRectAtTime(time,false).top;


Return to posts index

Filip Vandueren
Re: sourceRectAtTime individual group within layer
on Jun 29, 2020 at 1:08:54 pm

Nope, sourceRectAtTime() is a method of the layer-object only.

There are tricks to do what you want though: if there are given times at which a group is the only thing visible in the layer, that would yield the correct value.

So, setting the scale and position of the offending group to [0,0] achieves the effect of removing that group's influence to the bounding box…
(Given that the remaining Group is at it's default position/anchorpoint [0,0])

You could manually set up some keyframes beyond the reach of your current rendering Work Area where that's true. Or I've seen approaches where that information is "hidden" at times before zero, with expressions:

The groups that you want to exclude, should get this expression for both Group Position and Group Scale:
time>=0 ? value : [0,0];

The anchor-point of the layer should get this expression (note the time of -1):
sr=thisLayer.sourceRectAtTime(t = -1, includeExtents = true);
[l,t] + [w,h]/2;

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 All Rights Reserved