Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Invalid numeric result (divide by zero) on a text source

  • Invalid numeric result (divide by zero) on a text source

    Posted by Nick Hill on January 17, 2012 at 11:15 am

    Really odd one. I have the following code in a textSource property, to debug:

    t = timeToFrames(time);
    d = timeToFrames(thisComp.duration);
    c = thisComp.layer("control").effect("running_tot")("Slider"); // float value
    tot = thisComp.layer("control").effect("tot")("Slider"); // float value
    ave = tot / d;
    avetot = ave * t;
    playhead = avetot / c;
    "avetot: " + avetot

    This works fine. However, if I replace the last line with

    "c: " + c

    to see what value c has on a given frame, I get “invalid numeric result (divide by zero?)” pointing to that line.

    I must be missing something really, really obvious, but I don’t know why I’m getting this error – I’m not trying to divide anything, just display a value!

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

    January 17, 2012 at 2:16 pm

    I think this is one of those cases where, for some strange reason, you have to explicitly get the value of the slider, so try changing this:

    c = thisComp.layer(“control”).effect(“running_tot”)(“Slider”);

    to this:

    c = thisComp.layer(“control”).effect(“running_tot”)(“Slider”).value;

    Dan

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