Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions sourceRectAtTime() for shape layers?

  • sourceRectAtTime() for shape layers?

    Posted by Jackie Kustan on August 12, 2020 at 8:04 pm

    Short version: is it not possible to get a pixel width from a shape layer using sourceRectAtTime?

    I’ve been working on a script that, among other things, creates shape layers from imported illustrator layers. Once I’ve created these shape layers I’d like to get their position and their width so I can align other elements to their edges.

    When I try and fetch the width of the shape layer with sourceRectAtTime() the value I get is not the pixel width. If I use sourceRectAtTime() on the footage layer that created the shape I get an entirely different, smaller value, that as far as I can tell is correct (based on manually measuring).

    For example, for an illustrator footage layer “LayerOne” containing two paths:

    LayerOne.sourceRectAtTime(1000,true).width returns 90

    But if I convert LayerOne to paths using “Create Shapes from Vector Layer”:

    LayerOneOutlines.sourceRectAtTime(1000,true).width returns 107.64068(…)

    Any thoughts? I’m clearly missing something.

    Jackie Kustan replied 6 years ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    August 12, 2020 at 9:29 pm

    What do you get with sourceRectAtTime(1000,false) ?

    Dan

  • Jackie Kustan

    August 13, 2020 at 2:41 pm

    sourceRectAtTime(1000,false) returns 74.64(…) which does look like it aligns to the width of the paths, not including the stroke. I guess I’ll have to add my own margins, but thats a lot more usable than an opaque number.

    Of course, now I have no idea what “extents” actually means, since I assumed it would give me the width including the stroke. Looking a little further, at least I’m not the only one.

    Thanks Dan!

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