ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Is there a way to know the width and height of a layer similar to sourceRectAtTime?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mateo Baldasare
Is there a way to know the width and height of a layer similar to sourceRectAtTime?
on Jul 30, 2019 at 4:36:01 pm

Hi there!

I've been trying to figure this out for a while now and I wonder if it is actually possible through expressions.

I would like to know the resulting width and height of an image with an alpha channel (or that image inside a pre-comp), similarly as you would do with the expression for shape and text layers sourceRectAtTime().



I've tried with the sampleImage() expression, but that just gives me an average of the overall opacity.

Thanks!!


Return to posts index

Tomas Bumbulevičius
Re: Is there a way to know the width and height of a layer similar to sourceRectAtTime?
on Jul 30, 2019 at 6:02:23 pm
Last Edited By Tomas Bumbulevičius on Jul 30, 2019 at 6:05:09 pm

Hey Mateo,

what about simply width & height for a layer?


thisLayer.width
thisLayer.height


EDIT: I guess you are talking about the image, assuming that all the alpha around is part of it. Sorry! There is a good script called AutoCrop, which allows crop image without affecting any of its transformation props (if that helps)

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview


Return to posts index

Mateo Baldasare
Re: Is there a way to know the width and height of a layer similar to sourceRectAtTime?
on Jul 30, 2019 at 7:07:51 pm

Thanks a lot, Tomas!

That really does the trick for the cropped image 😃

I wonder if there is a workaround to do the same for a pre-comp (with the png image already cropped). I tried with the Collapse Transformations option checked and with the same expression, but it gives me the whole height or width (in this case 1920 by 1080).

Thanks again!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]