Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Changing Scale Based on Position

  • Changing Scale Based on Position

    Posted by Louis Hamwey on December 7, 2017 at 6:25 pm

    I am trying to have the scale of 2 solids be controlled by the position of a shape layer using this expression:

    a = 1;
    b = thisComp.layer(“Left_Bar”).transform.yPosition;
    d = length(a,b);
    s = (d/width)*100;

    e = thisComp.layer(“Vertical_Bar”).transform.xPosition;
    f = 1;
    g = length(e,f);
    i = (g/width)*100;

    [i,s]

    When for the top solid it works perfectly as the line moves up, it shrinks. But for the bottom solid it moves the inverse (see gif: )
    I think it’s an easy fix, I am just not very advance with expressions. Thanks!

    Andrei Popa replied 8 years, 8 months ago 2 Members · 1 Reply
  • 1 Reply
  • Andrei Popa

    December 8, 2017 at 9:15 am

    Try replacing second layer s with s = thisComp.height - (d/width)*100 or if your layer has the anchor point on the bottom,
    with s = transform.position[1] - (d/width)*100

    Andrei
    My Envato portfolio.

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