Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions sourceRectAtTime collapse transformations

  • sourceRectAtTime collapse transformations

    Posted by Thomas Collier on June 5, 2020 at 5:51 pm

    Does sourceRectAtTime not work with collapse transformations, or am I doing something wrong?

    I am trying to align my anchor point to the bottom left side of the precomp. Inside are items of various heights that turn on and off. I thought it would be as simple as turning on collapse transforms so sourceRect could find the height. My bounding box seems correct when I collapse transformations, but the anchor point sticks to the bounding box of the comp without collapse transformations on.

    x=thisLayer.sourceRectAtTime().left;
    y=thisLayer.sourceRectAtTime().top+height;
    [x,y];

    Robert Müller replied 5 years, 11 months ago 3 Members · 5 Replies
  • 5 Replies
  • Andrei Popa

    June 6, 2020 at 8:05 am

    Here is an expression for bottom left anchor point

    var left = sourceRectAtTime(time,false).left;
    var myHeight = sourceRectAtTime(time,false).height;
    var top = sourceRectAtTime(time,false).top;
    [left,myHeight+top]

    Andrei
    My Envato portfolio.

  • Thomas Collier

    June 6, 2020 at 1:51 pm

    Yes, I am having the same issue with your version of the expression. The anchor point is snapping to the bounding box of the layer without collapse transformations on. My question is, can I attach the anchor point to the bounding box of the layer with collapse transformations on.

  • Andrei Popa

    June 8, 2020 at 7:55 am

    I don’t understand this behavior.
    Can you attach one or two photos?

    Andrei
    My Envato portfolio.

  • Thomas Collier

    June 8, 2020 at 1:38 pm

    Here is my precomp with 3 “logos” in it:

    Here is my main comp without collapse transformations on for the precomp, as you can see the bounding box is the size of the precomp:

    Here is my main comp with collapse transformations on for the precomp, the bounding box has changed to the height of my tallest layer:

    Here is the precomp with your sourceRectAtTime expression applied to the anchor point. Notice the anchor point is looking at the precomp size, even though collapse transformations is active.

  • Robert Müller

    June 9, 2020 at 8:44 am

    Yes, you are right. sourceRectAtTime does not work with collapse transformations checked on precomps there are workarounds using the sampleImage function and looking for alpha values. But this is not very user friendly because it takes lots of time to calculate. So your best bet would be to crop your precomp to the actualy size, there are excellent scripts for this out there.

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