Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions rescaling numbers

  • Posted by Rob Dupuis on August 26, 2009 at 9:23 pm

    i need a blur effect of 0 when the distance between 2 specific objects are under 1064. When the distance between these 2 objects get over 1064 I need it to start blurring from 0. When the distance between these 2 objects are 2748 or over, the blur should be at 50.

    been trying to figure this out forever. It sounds kinda simple and sounds like something I should be able to figure out, but I’m stuck!

    Thanks in advance guys, I know somebody here will be able to figure it out.

    Rob Dupuis replied 16 years, 8 months ago 3 Members · 3 Replies
  • 3 Replies
  • Rob Dahl

    August 26, 2009 at 11:37 pm

    Well…

    See code for one way to do it.
    I created a Comp with two objects on it.
    Object 1 is Dark Blue Solid 1 50 px square.
    Object 2 what a White solid 50px square.
    On the While box I added a Gaussian Blur.
    Below was the code I created for the Blurriness control.

    I am sure others will provide another way.

    loc_obj1=thisComp.layer("Dark Blue Solid 1").transform.position[0]; // get object 1 X location
    loc_obj2=transform.position[0]; //get object 2 X location
    delta_Objs=loc_obj2-loc_obj1; // Determine the distance between Object 2 and 1
    Cntr_space=2748-1064; // The controlled space defined for blur
    Multiplier=51/Cntr_space; // The controlled space linearly divided for 0-50
    delta_Blur=Multiplier*(delta_Objs-1064); // The point at which the blur starts. Final line - The blur effect applied until 50, then blur is constant.
    if(delta_Blur<=50){delta_Blur}else{50}

    Rob Dahl
    Transparent Alchemy
    Boulder City, NV 89005
    http://www.transparentalchemy.com

  • Dan Ebberts

    August 27, 2009 at 12:37 am

    If there aren’t any parents involved, it could be as simple as this:

    p1 = thisComp.layer(“layer 1”).transform.position;
    p2 = thisComp.layer(“layer 2”).transform.position;
    linear(length(p1,p2),1064,2748,0,50);

    Dan

  • Rob Dupuis

    August 27, 2009 at 5:32 pm

    Wow, I really appreciate this guys, but I think a friend an I came up with a much solution before I had a chance to come back here.

    50/(2282-1064) = 0.0410509… (ratio number)
    then I inserted that ratio number in my equation in my Gaussian Blur expression on the object I with to blur:

    x = (thisComp.layer(“dolly”).transform.position[2] – transform.position[2])*-1;
    (x – 1064)*0.0410509;

    if (x > 4000){
    120
    }

    where “dolly” is, that’s the null object I use to control my camera. It’s “*-1” cause all my number info is in the negative due to where my objects are in the scene. And if the distance is more than 4000 than stay blurred at 120.

    Thanks to all who came up with ideas for me.

    RD

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