Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Changing X-scale based on position.

  • Changing X-scale based on position.

    Posted by Kerr Scott on December 28, 2017 at 12:51 pm

    Hi there,

    I’m looking for a way to change just the Y scale based on the position or distance from a certain point. For example as an object moves further away from the anchor point of another object it scales the Y position (gets slimmer) as it moves away from it.

    So far I’ve found this which does both scale dimensions and only does it to the centre of the comp. Not a specific point / null / layer etc:

    Any help is greatly appreciated. Thanks in advance!

    pct = .50; // increase by 25%
    r = 100; // distance to being increasing scale
    center = thisComp.width/2;
    p = toWorld(anchorPoint);
    d = length(p,[center,p[1]]);
    mult = ease(d,0,r,pct,0);
    value*(1+mult)

    Kevin Camp replied 8 years, 6 months ago 2 Members · 1 Reply
  • 1 Reply
  • Kevin Camp

    December 28, 2017 at 8:01 pm

    try this:
    target = thisComp.layer("Null 1"); //change this to the layer you want to target
    mul = .001; //change this to effect how much change in scale
    d = length( position, target.position );
    xScale = mul * value[0] * d;
    [ xScale, value[1], ]

    the expression assumes that neither layer is parented (or if they are they are parented to the same layer). if the layers are parented to other layers, we’ll need to add a layer-space transform function.

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

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