Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions counter duration between two markers

  • counter duration between two markers

    Posted by Adam Levine on February 18, 2015 at 7:50 am

    pls!!! I need help… i need to modify this expression “duration” (“dur”) to duration between two markers duration.. sorry for my English…

    That mean I need to count this counter from first marker to next marker….
    (I need to modify 6th row “dur” for that)
    can anyone give me suggestions…
    pls help… Thank you…

    numDecimals = 0;
    commas = true;
    dollarSign = false;
    beginCount = comp("Credits").layer("Lower Third Controller").effect("Begin Count Number")(1);
    endCount = comp("Credits").layer("Lower Third Controller").effect("End Count Number")(1);
    dur = comp("Credits").layer("Lower Third Controller").effect("Counter Duration")(1);

    t = time - inPoint;
    s = linear (t, 0, dur, beginCount, endCount).toFixed(numDecimals);

    prefix = "";
    if (s[0] == "-"){
    prefix = "-";
    s = s.substr(1);
    }
    if(dollarSign) prefix += "$";

    if (commas){
    decimals = "";
    if (numDecimals > 0){
    decimals = s.substr(-(numDecimals + 1));
    s = s.substr(0,s.length - (numDecimals + 1));
    }
    outStr = s.substr(-s.length, (s.length-1)%3 +1);
    for (i = Math.floor((s.length-1)/3); i > 0; i--){
    outStr += "," + s.substr(-i*3,3);
    }
    prefix + outStr + decimals;
    }else{
    prefix + s;
    }

    Adam Levine replied 11 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 18, 2015 at 5:35 pm

    If I understand what you’re trying to do, I think you can just change this line:

    s = linear (t, 0, dur, beginCount, endCount).toFixed(numDecimals);

    to this:

    s = linear (time, marker.key(1).time, marker.key(2).time, beginCount, endCount).toFixed(numDecimals);

    You should then also be able to delete the lines that define “dur” and “t”.

    Dan

  • Adam Levine

    February 18, 2015 at 5:52 pm

    Thank you so much Master Dan Ebberts…. It’s totally work …thank you again… 😀 🙂

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