FORUMS: list search recent posts

# How do you change size of one object gradually relative to position of another?

FAQ   •   VIEW ALL
 How do you change size of one object gradually relative to position of another? on Feb 14, 2016 at 2:00:05 pm

Hi guys.
I wonder if you could help me with a puzzle. I think this can only be done with scripting, but I could be wrong. I'm quite new to scripting, so the solution might be pretty simple.

It goes something like this:
If Object A has Y coordinate 600, the scale Object B to 20.
If Object A has Y coordinate 300, then scale Object B to 100.

An if/else script might work, but now here's the bit I can't figure out:

If Object A's Y coordinates are BETWEEN 300 and 600, then scale Object B BETWEEN 20 and 100.

Any ideas would be appreciated :)

 Re: How do you change size of one object gradually relative to position of another?on Feb 15, 2016 at 7:44:14 am

You can use the linear function, this way:

```ypos=thisComp.layer("A").transform.position[1]; x = linear(ypos, 600, 300, 20, 100); [x,x];```

Xavier