Skip to main content
Participating Frequently
June 8, 2022
Question

Keep distance between layers when scaling middle layer.

  • June 8, 2022
  • 2 replies
  • 465 views

Hi, have three layres equidistant in y. Would like to scale the middle layer and have it 'push' the top layer up, bottom layer down but maintain the distance 'border' between them all.

Have got as far as - thisComp.layer("Null 1").transform.scale[0] - but this only creates a downward movement - can move up but only if I scale below 0 which of course I don't want.

Can anyone tell me how I'd go about making a positive scale factor push the top layer up?

Or if anyone knows how to sort this scale/boreder thing.

I basically have no idea what I'm doing so any help gratefully recieved.

Thanks.

This topic has been closed for replies.

2 replies

Mylenium
Legend
June 8, 2022

You multiply the position value by -1 to move in the opposite direction or simply subtract it instead of adding. The rest is a simple case of interpolating the driver value to the position value. Example:

 

mScaleY=thisComp.layer("XYZ").transform.scale[1];

mPosX=value[0];

mPosY=value[1];

 

X=mPosX;

Y=linear(mScaleY,100,500,mPosY, mPosY+500);

 

[X,Y]

 

Change the values as needed to accomodate for your actual layer sizes and placement and apply it to the position property. Of course this could be fancied up in a million ways, but that would require more precise info about how you want it to work, what your actual values are and so on.

 

Mylenium

Participating Frequently
June 8, 2022

Thanks. New to this expressions lark so will work through this.

Adam24585301qycn
Inspiring
June 8, 2022

multiply by a negative value

Participating Frequently
June 8, 2022

Thanks for that. Multiply what by a negative value?