Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Position Expression Help

  • Position Expression Help

    Posted by Alts on May 19, 2005 at 5:46 pm

    This should be easy for you guys. I’m pretty much noobed-out as far as expressions go because I am not familiar with the syntax. I have three layers (1, 2 and 3) and I would like to be affected by the positon of a null object. A perfect example of how I would like them to be affected is the default lensflare motion, where, if you drag the “Flare Center” around, you see the circles move exponentially away from the center of your comp and then back in as you drag towards the center. So basically lets imagine a null object and three spearate layers all beginning at the center of our comp. I would like to be able to drag the null object in any direction and have the layers move the opposite direction at varying distances – layer 3 moves twice distance as layer 2 which moves twice the distance of layer 1 (for simplicity, I would rather their respective distances all be based off the distance of the null object and not eachother). Once you get me started I understand how to change the numbers to get the correct distances… just need that little push.

    Thank you for your help and time,
    alts

    Alts replied 21 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    May 19, 2005 at 7:51 pm

    Probably something like this:

    center = [thisComp.width,thisComp.height]/2;
    delta = thisComp.layer(“Null 1”).position – center;
    factor = Math.pow(2,index-1);
    value – index*delta*factor

    The layers that you’re spreading should be at the top of the layer stack (layers 1 thru n).

    Dan

  • Alts

    May 19, 2005 at 8:38 pm

    Mr. Ebberts,

    You are a special, special person. Thank you so much.

    Kind Regards,
    alts

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