Skip to main content
Inspiring
May 8, 2017
Answered

Scale by proximity script

  • May 8, 2017
  • 1 reply
  • 3165 views

Hi all,

I'm searching for an expression I can use so I don't go insane. See the attached image. I want each number to scale from 100% to 150% as the red line approaches. So if the red line is 200 or more pixels away from the number's anchor, the scale is 100%. If it's right on top, it's 150%.

Thank you.

  -  Geoff

    This topic has been closed for replies.
    Correct answer Rick Gerard

    Try naming your red line layer "Red Line" and using this expression for scale on a text layer:

    t = length(position, thisComp.layer("Red line").position);

    s = ease(t, 200, 0, 150, 100);

    [s, s]

    The Length method is under the Vector Math section of the expression language menu, the ease method is under the Interpolation section.

    You are measuring the length between the anchor point of the current layer and the anchor point of the Red Line layer. Then a simple interpolation method takes the length ("t" for temporary value of length) and applies an ease when t starts at 200 and ending at zero between 150 and 100. The result of the interpolation method translates to scale for the layer with the expression.

    For this to work properly the text layers should be created with the anchor point directly in the center of the text in a center justified paragraph. You can easily center the anchor point by using the baseline shift property in the Character Panel. Start by using the resetting the position of any text layer you created by clicking with the type tool anywhere in the comp panel and typing, then match the baseline shift for every layer.

    That should do it.

    1 reply

    Community Expert
    May 8, 2017

    Let me get this straight. The red vertical line moves along the timeline. As the red line approaches a date the text scales up. If each date is on a separate text layer then you could use the position of the red line and a length method to scale as the red line approaches. If all of the dates are on the same layer then you could use a text animator for scale and just keyframe by hand. You could also use timeline markers and an expression based on time. It all depends on how much monkeying around you plan to do when setting up the composition, the length of the shot and how many changes you need to make.

    If I had a narration track that I was using to time the movement of the red line I"d just throw a couple of markers in the timeline to indicate kay points, animate the position of the red line, then use a text animator for scale and animate by hand. It would take seconds to get the timing correct.

    If I needed to build an automated system that followed the movement of the red line I would probably use a length method tied to the anchor point of each date layer. Put the anchor point of each date layer in the middle of the date and then use the same length method to ease the scale up and down for the text layer.

    I'm no where near AE right now and wouldn't attempt to write the expression without checking it in AE but it should be pretty straight forward.

    Inspiring
    May 8, 2017

    I think you understand my problem conceptually, I just don't know anything about expressions, so I'm hoping someone can give me something that I can edit and paste into the scale of each number.

    Rick GerardCommunity ExpertCorrect answer
    Community Expert
    May 8, 2017

    Try naming your red line layer "Red Line" and using this expression for scale on a text layer:

    t = length(position, thisComp.layer("Red line").position);

    s = ease(t, 200, 0, 150, 100);

    [s, s]

    The Length method is under the Vector Math section of the expression language menu, the ease method is under the Interpolation section.

    You are measuring the length between the anchor point of the current layer and the anchor point of the Red Line layer. Then a simple interpolation method takes the length ("t" for temporary value of length) and applies an ease when t starts at 200 and ending at zero between 150 and 100. The result of the interpolation method translates to scale for the layer with the expression.

    For this to work properly the text layers should be created with the anchor point directly in the center of the text in a center justified paragraph. You can easily center the anchor point by using the baseline shift property in the Character Panel. Start by using the resetting the position of any text layer you created by clicking with the type tool anywhere in the comp panel and typing, then match the baseline shift for every layer.

    That should do it.