Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Dan-Expression for Counting

  • Jason Snell

    April 6, 2012 at 2:12 am

    Doh! I need another comma — larger number, I kept screwing up the code…

    1,200,000,000

    Thanks for your help!

  • David Cabestany

    September 22, 2012 at 12:02 am

    Does anyone know what could I be doing wrong here? I need a counter from 0 to 100 followed by a % sign.
    I’ve done it in the past hundreds of times and it always worked, but today, when I add +”%” at the end of the expression I get the following error:

    Invalid numeric result (divide by zero?)

    However if I just type 100 +”%” the expression runs fine, obviously it’s useless since it’s not animating, but I just can’t figure out why is not working when linked to a slider control. If I just add the slider control without the % sign, it also runs ok.

    I don’t know if the code was changed for CS6 or something like that.

    Anyone who wants to show me what I’m doing wrong?
    Thanks

    effect("Slider Control")("Slider")+"%"

  • Dan Ebberts

    September 22, 2012 at 12:36 am

    Try it this way:

    effect(“Slider Control”)(“Slider”).value + “%”

    Dan

  • David Cabestany

    September 22, 2012 at 2:07 am

    Thanks Dan,

    I eventually fixed it by adding a Math function at the beginning, I don’t know why, but that solved the problem.

    Do you know if this is a bug or it’s expected behavior? It looks very odd to me.

    Thanks again.

  • Dan Ebberts

    September 22, 2012 at 5:12 am

    I don’t know if it’s a bug. When you use:

    effect(“Slider Control”)(“Slider”)

    You are technically referring to the Slider object. That object has a number of attributes, including name, propertyIndex, speed, numKeys, and of course value. For some reason, most of the time, if you don’t specify an attribute, the expression engine will assume you want to use value. But not always. Sometimes (as in your case) it doesn’t assume the value attribute and just takes it as an object reference. It’s not consistent and “divide by zero?” doesn’t make a lot of sense.

    Dan

  • Gray Wilcox

    October 24, 2012 at 10:01 pm

    this is all working wonderfully for me.

    But… Can anyone explain why my text is now moving along the x axis as the numbers change? I read that using a monospaced font will help keep it in place (https://www.motionscript.com/design-guide/counter.html) but is there a work around for this?

    thanks in advance!!!

  • Dan Ebberts

    October 24, 2012 at 10:34 pm

    The only thing i can think of (short of using a mono-spaced font) would be to use a separate text layer for each digit. You could then either use the same expression on each layer, but isolate that layer’s digit, or you could just turn off the visibility of the master text layer (the one with the expression) and have expressions on the individual layers get their digit from the appropriate digit of the master. Kind of a pain either way, but do-able.

    Dan

  • Liran Tabib

    April 22, 2016 at 6:22 am

    I know this is an old question, but I created a new solution to create running numbers animation, I hope you Find this Useful. Counter Preset:
    https://www.vdodna.com/products/counter-preset/

  • David Cabestany

    April 22, 2016 at 2:52 pm

    May I suggest you contact Lloyd Alvarez at aescripts.com? You will have better chances of selling it over there than on your own.

    Best,
    D.

  • Liran Tabib

    April 23, 2016 at 5:35 pm

    Thank you for the reference, i think they sell only scripts and plugins but no Presets. I’ll try Lloyd maybe he could help.
    Best regards
    Liran

Page 2 of 3

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