ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Reduce scale on Layer A, and increase scale on Layer B

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alex Barratt
Reduce scale on Layer A, and increase scale on Layer B
on Jun 11, 2020 at 11:34:28 am
Last Edited By Alex Barratt on Jun 11, 2020 at 11:44:13 am

Hey all,

This simple thing became a bit more complicated I first thought..

How do I get my scale size to decrease on one layer, but at the same time increase the size on another layer?

I.e.
Layer A changes from 100% to 50% scale.
Layer B changes from 100% to 200% scale.

Thanks!

--

Alex T. Barratt
Multimedia Designer


Return to posts index

Robert Müller
Re: Reduce scale on Layer A, and increase scale on Layer B
on Jun 11, 2020 at 12:56:18 pm

Hi Alex,
this should do what you are looking for. It feels like there should be a more elegant way but I cant think of one atm:
sFact=thisComp.layer("layer_1").transform.scale[0]/100;
if(sFact == 0){
sFact = 0.0000001
}
s=transform.scale[0]/sFact;
[s,s]

It basicaly gets the scaling factor from the first layer and divides its scale by the factor, hence negating it. So if your layer scales up to eg 200 (scale factor 2) the other value gets devided by this, so it goes down to 50.
Note that the layer with the expression could never truly reach 0, only get very small. I added the if loop for the case your first layer reaches zero and the expression wont break for dividing by zero, so I inserted a very small number.


Return to posts index

Alex Barratt
Re: Reduce scale on Layer A, and increase scale on Layer B
on Jun 12, 2020 at 1:56:10 pm

Thanks Robert! That's what I was looking for.

--

Alex T. Barratt
Multimedia Designer


Return to posts index

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