Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression for scaling based on null position

  • Expression for scaling based on null position

    Posted by Steven Tader on October 8, 2012 at 7:20 pm

    I have a 2D comp with several icons that I want to scale with an expression based on the position of a null. I’m trying to create the effect of the icon growing as a mouse pointer passes by. I started with an expression that Dan Ebberts posted a while back, but I keep getting errors when I try to get it to work relative to the null position rather than the comp center. The problem I’ve had is that I can’t get it to factor in the Y position too.

    I’m also stuck on getting it to look at the true null position if I parent it to another null, but that’s not totally essential.

    Thanks!

    pct = .25; // 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)

    Lukasz Pason replied 12 years, 7 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    October 8, 2012 at 7:37 pm

    Try it this way:

    L = thisComp.layer(“Null 1”);
    pct = .25;
    r = 100;
    p1 = toComp(anchorPoint);
    p2 = L.toComp(L.anchorPoint);
    d = length(p1,p2);
    mult = ease(d,0,r,pct,0);
    value*(1+mult)

    Dan

  • Steven Tader

    October 8, 2012 at 7:43 pm

    Thanks so much! That worked perfectly.

  • Lukasz Pason

    October 9, 2013 at 8:37 pm

    can you use this on a shape layer? Transforming the position of an elipse and having the size of a secondary ellipse scale?

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