Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Marker to text for rankings

  • Marker to text for rankings

    Posted by Obed Ampong on January 28, 2017 at 9:40 pm

    Hi everyone,

    Please, I need some help. I am trying to use markers to do rankings from the low to highest ranks like countdown from last to first. I tried this expression below but couldn’t give the one with the lowest rank and also give me an error at the highest rank which is supposed to be number 1.

    Thanks for your help in advance.

    Obed

    f = 20; // number of transition frames
    dur = (f*thisComp.frameDuration);
    if (marker.numKeys > 0){
    n = marker.numKeys - marker.nearestKey(time).index;
    if (marker.key(n).time < time){
    n++;
    if (n > marker.numKeys) n = 0;
    }
    if (n == 0){
    y = marker.numKeys;
    }else{
    t = marker.key(n).time;
    y = ease(time,t - dur,t,n-1,n);
    }
    }else{
    y
    }

    Obed Ampong replied 9 years, 3 months ago 2 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    January 28, 2017 at 11:46 pm

    The expression has some problems. But neglecting that for the time being, what is it you’re trying to do exactly?

    Dan

  • Obed Ampong

    January 29, 2017 at 10:11 am

    Hello,
    I am trying to count from 50 to 1 with markers on the text layer using an expression on the source Text, I want the numbers to count only exactly on the marker point, then maintain it and change again on the next marker till it I reached 1. I have modified the expression I used earlier to work, however, it does not change exactly on the marker point, it changes in the middle point between the markers.
    Thanks
    Obed

    n=(marker.numKeys-(marker.nearestKey(time).index));
    if (marker.numKeys=marker.nearestKey(time).index);
    {
    Math.floor(n+1)
    }else{
    n
    }

  • Dan Ebberts

    January 29, 2017 at 5:49 pm

    Try this:


    m = marker;
    val = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (time < m.key(n).time) n--;
    val = m.numKeys - n;
    }
    val

    Dan

  • Obed Ampong

    January 29, 2017 at 9:36 pm

    Perfect!!
    Thanks so much

  • Obed Ampong

    January 29, 2017 at 11:12 pm

    Perfect!!
    Thanks so much
    but please is it possible to modify it for to end it with 1, instead of 0

    Obed

  • Dan Ebberts

    January 30, 2017 at 12:09 am

    Well, you could do this:


    m = marker;
    val = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (time < m.key(n).time) n--;
    val = m.numKeys +1 - n;
    }
    val

    but it means you need one marker less than the starting count.

    Dan

  • Obed Ampong

    January 30, 2017 at 12:44 pm

    Ok, it works
    Thanks a lot

    Obed

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