Skip to main content
Participant
August 1, 2024
Answered

Link Slider to Markers

  • August 1, 2024
  • 2 replies
  • 811 views

Theres a simple way to link a slider to a markers?

Where the slider decimals numbers keep couting between markers numbers?

Thanks

This topic has been closed for replies.
Correct answer Dan Ebberts

Almost there!

And what about the decimals?

The numbers between 1 and 2?


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;
}

2 replies

Legend
August 1, 2024

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);
Dan Ebberts
Community Expert
Community Expert
August 1, 2024

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
soares.mAuthor
Participant
August 1, 2024

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.

Dan Ebberts
Community Expert
Community Expert
August 1, 2024

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