Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Point slider form comma’s to dots?

  • Point slider form comma’s to dots?

    Posted by Olaf van Egeraat on November 12, 2020 at 4:32 pm

    Hello Creative cows,

    I have a question regarding my timer: it works perfectly fine but I want it to have a decimal points where the comma’s are. I’m still figuring everything out with point control.

    Online I always see it the other way around: from points to comma’s.

    Does anyone know how to add code to it changes it?

    s = “” + Math.round(effect(“Point Control”)(“Point”)[0]);

    s.replace(/\B(?=(\d{3})+(?!\d))/g, “,”);

    Olaf van Egeraat replied 5 years, 8 months ago 3 Members · 4 Replies
  • 4 Replies
  • Brendon Murphy

    November 13, 2020 at 7:30 pm

    I can’t understand from your post what you are trying to do with the point control, but you can replace commas in text with periods like this:

    s = value; //some text with commas

    s.replace(/,/g, "."); //replace the commas

    If your source for s is a number, you may need to convert it to a string first using the toString() method.

  • Filip Vandueren

    November 14, 2020 at 1:54 pm

    Hi Olaf,

    in the new Javascript engine you can do this:

    num = 123456789.012;
    num.toLocaleString('nl');

    this will give you dutch nl style numbers: 123.456.789,012

    change it to ‘en’ for the english style: 123,456,789.012

    ‘ru’ for russian style: 123 456 789,012

    ‘gu’ for gujarati: 12,34,56,789.012

    ‘fa’ for farsi: 123٬456٬789٫012 (won’t show up correctly: superscript commas for thousands)

    etc.

    Much better and robust than using string replacements

  • Olaf van Egeraat

    November 19, 2020 at 9:41 am

    Thanks! It’s a count-up form 0 to 5 million 🙂

  • Olaf van Egeraat

    November 19, 2020 at 10:19 am

    Hey Filip: do i add this to the expression of the point control of the source text itself?

    It makes to animation of 0 – 5 million completely quit.

    if I add to to code above (source text)

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