Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects numbers interpolation

  • numbers interpolation

    Posted by Troy Benesch on March 16, 2007 at 7:13 pm

    Hello,

    Is there a way to interpolate between two numbers in a linear fashion? For example, starting with value 56,432 have it interpolate to the new value 3,456,321 (keeping the commas) so that the viewer sees it calculating.

    Thanks for any advice,

    Troy

    Troy Benesch replied 19 years, 5 months ago 3 Members · 14 Replies
  • 14 Replies
  • Filip Vandueren

    March 16, 2007 at 8:08 pm

    check this thread:

    “Numbers or text expression with a ,”
    https://forums.creativecow.net/readpost/2/880169?univpostid=880128&pview=t

  • Troy Benesch

    March 17, 2007 at 1:25 am

    Thanks for the link and response. I did try to find some archival information on this topic as I’m sure someone else needed to achieve this result. I’m really amazed that a formula that does something like “over x seconds, start at value y and end at vale z” I could comp in some commas if that is an added issue. I looked at the expression you wrote and am hoping that it will do the trick. However, I’m not sure what parameter do I add the expression to? Do I create a blank text layer and then add an expression to the ‘source text’ parameter (probably not since I tried this and it doesn’t work)? Do I need to create more than one text layer?

    Thanks,

    Troy

  • Filip Vandueren

    March 17, 2007 at 1:41 am

    The recipe for this would be:

    – create a text-layer,
    – add an effects->Expression Controls->point-control to it.
    – add the expression to the SourceText parameter
    – now animate the value of the point control, it’s X coordinate controls the number. The reason for this is that you can achieve much larger numbers than with a Slider control.

    This script adds the commas and limits the decimals to 2.
    If you don’t want decimals, change the line:
    formattedText = numAsText.substring(dotIndex-3,dotIndex+3); // +4 for 3 decimals etc.

    to this:

    formattedText = numAsText.substring(dotIndex-3,dotIndex);

  • Sam Moulton

    March 17, 2007 at 3:34 am

    sliders go to a million 1,000,000
    point controls go to 32,000

    just go to edit value to put in the max value of a million for a slider.

  • Sam Moulton

    March 17, 2007 at 3:49 am

    just found out that you can type really big numbers in the point control but you can only go up to 32000 if you use edit value….
    good tip…

  • Sam Moulton

    March 17, 2007 at 3:49 am

    just found out that you can type really big numbers in the point control but you can only go up to 32000 if you use edit value….
    good tip…

  • Filip Vandueren

    March 17, 2007 at 12:38 pm

    I just ‘Scrub’ the values in the timeline or the effects-controls, or double click on the number to type it in directly.
    I hadn’t noticed the Set Value Dialog indeed limits your value.

    Another weird thing I noticed:

    Angle Controls go up to

    2147483647x + 360

  • Sam Moulton

    March 17, 2007 at 9:37 pm

    I noticed that if you use a slider instead of a point control in your expression you get an index error. What’s that about?

    the error says FunctionnumAsTest.indexOf is undefined.

    It’s in line 3

  • Filip Vandueren

    March 17, 2007 at 11:15 pm

    That error would imply that the variable numAsText is not containing a String.

    indexOf() is a method of Strings, it searches for occurences of a character, in our case we want to check for the possible location of a decimal point within the number: numAsText.indexOf(“.”);

    If the first lines would read this:

    num=effect(“Slider Control”)(“Slider”);
    numAsText= “”+num;

    You should have no error, the second lines adds the value to an empty string “”, ensuring that the number is converted to a String.
    Pickwhip the num= to your slider.

  • Sam Moulton

    March 18, 2007 at 1:48 am

    That’s exactly what I’ve got… But there’s still the error.

    original point control expreession:
    num = effect(“Point Control”)(“Point”)[0];
    numAsText= “”+num;
    dotIndex = numAsText.indexOf(“.”); // check for decimals
    if (dotIndex==-1) { dotIndex=numAsText.length; }

    formattedText = numAsText.substring(dotIndex-3,dotIndex+3); // +4 for 3 decimals etc.

    if (dotIndex>3) {
    for (i=dotIndex-3 ; i>0 ; i=i-3) {
    extractedText = numAsText.substring(i-3,i);
    if (extractedText==”-“) {
    formattedText = extractedText + formattedText
    } else {
    formattedText = extractedText + “,” + formattedText
    }
    }
    }

    The slider control expression that gives the errors.

    num = effect(“Slider Control”)(“Slider”);
    numAsText= “”+num;
    dotIndex = numAsText.indexOf(“.”); // check for decimals
    if (dotIndex==-1) { dotIndex=numAsText.length; }

    formattedText = numAsText.substring(dotIndex-3,dotIndex+3); // +4 for 3 decimals etc.

    if (dotIndex>3) {
    for (i=dotIndex-3 ; i>0 ; i=i-3) {
    extractedText = numAsText.substring(i-3,i);
    if (extractedText==”-“) {
    formattedText = extractedText + formattedText
    } else {
    formattedText = extractedText + “,” + formattedText
    }
    }
    }

    AE7 on a mac

Page 1 of 2

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