FORUMS: list search recent posts

Resize a layer according to the image size

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jeff Horowitz
Resize a layer according to the image size
on May 8, 2014 at 7:42:36 pm

So I have two layers: 1) is a solid. 2) is an image.

I want to add an expression to the scale property of the solid to tell it to resize according to the size of the image.

The whole comp is 1920x1080
The solid is 1920x1080 & scaled down to 78.0,80.0%
The image.png is 1920x1080 & scaled down to 75.0,75.0%

Here's the example:

Now, if I replace that 1920x1080 image with an image that is 400x533, I want the white solid to resize to fit the dimensions of the new image.

Here's the example:


Return to posts index


Dan Ebberts
Re: Resize a layer according to the image size
on May 8, 2014 at 9:09:58 pm

This assumes that the solid is directly below the image. Adjust the variable "border" to adjust the border width.

L = thisComp.layer(index-1);
border = 20;
w = L.width*L.scale[0]/100 + border*2;
h = L.height*L.scale[1]/100 + border*2;
[w*100/width,h*100/height]

Dan



Return to posts index

Jeff Horowitz
Re: Resize a layer according to the image size
on May 9, 2014 at 12:04:13 am

That worked perfectly...thanks

JAH


Return to posts index

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