3 Replies Latest reply on Feb 7, 2016 12:50 PM by Ireground

    Display Variable Number


      Hi everybody.

      Here's what I'm trying to do: I have a double sided arrow indicating the distance between two things. The arrow will get shorter as the two things come closer together (basically those two things are squeezing the arrow), so I'll keyframe its scale. I have a number over the arrow, which is the measure between those two things. I'd like the number to decrease gradually as the arrow gets shorter. I'm guessing there's a way to do that by parenting the "scale" property of the arrow to the number, and using an expression that decreases the number gradually as the arrow narrows. Is that possible?



        • 1. Re: Display Variable Number
          Rick Gerard Adobe Community Professional & MVP

          You add an expression to the text layer by alt/option clicking Source Text. You point the expression to the scale value you want to use. Let's say you are doing the scaling horizontally, then you would point to the X scale value. If your arrow was vertical you would point to the Z scale value. Now you add a linear method to the scale value and if you want whole numbers you round the result. Say you wanted the numbers to go from 1000 to 10 so your linear expression would say something like v = linear(t, 0, 100, 10, 1000)


          The expression for whole numbers would look like this:

          t = thisComp.layer("Shape Layer 1").transform.scale[0];

          n = linear(t, 0, 100, 10, 1000)


          The expression gets more complicated if you need decimal places. This universal counter from Dan Ebberts is a good place to start: Universal Counter

          • 2. Re: Display Variable Number
            Gutter-Fish Level 4

            You also can apply the text effect "Numbers" to a solid layer then connect the value attribute to the scale attribute of the arrow.  It's a quick and dirty solution but may give the result you want without having to write the expression yourself.

            • 3. Re: Display Variable Number
              Ireground Level 1

              Cool. I'll try that. Thanks for the replies.