Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › How do you change size of one object gradually relative to position of another?

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

    Posted by Bevis Lowry on February 14, 2016 at 2:00 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 🙂

    Bevis Lowry replied 10 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Xavier Gomez

    February 15, 2016 at 7:44 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

  • Bevis Lowry

    February 15, 2016 at 7:48 am

    perfect!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy