ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Marker to text for rankings

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Obed Ampong
Marker to text for rankings
on Jan 28, 2017 at 9:40:43 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 &lt; 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
}


Return to posts index

Dan Ebberts
Re: Marker to text for rankings
on Jan 28, 2017 at 11:46:16 pm

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

Dan



Return to posts index

Obed Ampong
Re: Marker to text for rankings
on Jan 29, 2017 at 10:11:38 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
}



Return to posts index


Dan Ebberts
Re: Marker to text for rankings
on Jan 29, 2017 at 5:49:12 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



Return to posts index

Obed Ampong
Re: Marker to text for rankings
on Jan 29, 2017 at 9:36:25 pm

Perfect!!
Thanks so much


Return to posts index

Obed Ampong
Re: Marker to text for rankings
on Jan 29, 2017 at 11:12:24 pm

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

Obed


Return to posts index


Dan Ebberts
Re: Marker to text for rankings
on Jan 30, 2017 at 12:09:36 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



Return to posts index

Obed Ampong
Re: Marker to text for rankings
on Jan 30, 2017 at 12:44:29 pm

Ok, it works
Thanks a lot

Obed


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]