Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Link Slider to Markers

New Here ,
Aug 01, 2024 Aug 01, 2024

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

Where the slider decimals numbers keep couting between markers numbers?

Thanksexpression.png

TOPICS
Expressions , How to , Scripting
551
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 01, 2024 Aug 01, 2024

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;
}
Translate
Community Expert ,
Aug 01, 2024 Aug 01, 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 01, 2024 Aug 01, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 01, 2024 Aug 01, 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 01, 2024 Aug 01, 2024

Almost there!

And what about the decimals?

The numbers between 1 and 2?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 01, 2024 Aug 01, 2024

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;
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 02, 2024 Aug 02, 2024
LATEST

God bless you, Dan.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 01, 2024 Aug 01, 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);
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines