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

Link Slider to Markers

New Here ,
Aug 01, 2024 Aug 01, 2024

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?

Thanksexpression.png

TOPICS
Expressions , How to , Scripting

Views

329

Translate

Translate

Report

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

Votes

Translate

Translate
Community Expert ,
Aug 01, 2024 Aug 01, 2024

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

Votes

Translate

Translate

Report

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

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.

Votes

Translate

Translate

Report

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

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Almost there!

And what about the decimals?

The numbers between 1 and 2?

Votes

Translate

Translate

Report

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

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

God bless you, Dan.

Votes

Translate

Translate

Report

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
Enthusiast ,
Aug 01, 2024 Aug 01, 2024

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

Votes

Translate

Translate

Report

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