Copy link to clipboard
Copied
Theres a simple way to link a slider to a markers?
Where the slider decimals numbers keep couting between markers numbers?
Thanks
Like this, I guess:
m = marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
}
if (n > 0 && n <m.numKeys){
linear(time,m.key(n).time,m.key(n+1).time,n,n+1);
}else{
n;
}
Copy link to clipboard
Copied
It's not clear to me what you're asking exactly, but maybe something like this:
m = marker;
t = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
if (n > 0){
t = time - m.key(n).time;
}
}
t
Copy link to clipboard
Copied
Thank you for your reply Dan, and yes, i wasnt clear with my question.
The expression, is ok.
The counter started at the first marker, but they count comp seconds between markers and restarted at the second marker.
I wish the slider count first marker as 1 and second as 2 and subsequently.
Copy link to clipboard
Copied
Ah, OK. That's simpler:
m = marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
}
n
Copy link to clipboard
Copied
Almost there!
And what about the decimals?
The numbers between 1 and 2?
Copy link to clipboard
Copied
Like this, I guess:
m = marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
}
if (n > 0 && n <m.numKeys){
linear(time,m.key(n).time,m.key(n+1).time,n,n+1);
}else{
n;
}
Copy link to clipboard
Copied
God bless you, Dan.
Copy link to clipboard
Copied
I would go with something like this:
m1 = thisComp.layer("Shape Layer 1").marker.key(1).time;
m2 = thisComp.layer("Shape Layer 1").marker.key(2).time;
linear(time, m1, m2, m1, m2 - m1);