Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Adding a + to slide control

  • Adding a + to slide control

    Posted by Katie Wes on April 26, 2017 at 2:01 pm

    Currently using the expression code below for commas in my slider control but I also need to add a + to the start of the number. Could anyone tell me what I need to add?

    var num = effect(“Slider Control”)(“Slider”)
    num = Comma(num);
    [num]

    function Comma(number)
    {
    number = ” + Math.round(number);
    if (number.length > 3)
    {
    var mod = number.length % 3;
    var output = (mod > 0 ? (number.substring(0,mod)) : ”);
    for (i=0 ; i < Math.floor(number.length / 3); i++)
    {
    if ((mod == 0) && (i == 0))
    output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
    else
    output+= ‘,’ + number.substring(mod + 3 * i, mod + 3 * i + 3);
    }
    return (output);
    }
    else return number;
    }

    Dan Ebberts replied 9 years, 4 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    April 26, 2017 at 5:06 pm

    You could change this:

    [num]

    to this:

    “+” + num

    Dan

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