Thank you very much Mr. Dan. Worked perfectly.
While I have you, I’m working with this expression below to use marker’s index to count the number of markers and put in “Offset” value with a little easing.
I want the value to start from 0 every time there is a marker with empty comment.
// Check for markers
numMarkers = marker.numKeys;
// Assign value to marker index with easing
if (numMarkers > 0) {
nearestMarkerIndex = marker.nearestKey(time).index;
markerTime = marker.key(nearestMarkerIndex).time;
if (markerTime > time && nearestMarkerIndex > 1) {
prevMarkerTime = marker.key(nearestMarkerIndex - 1).time;
t = (time - prevMarkerTime) / (markerTime - prevMarkerTime);
markerIndex = nearestMarkerIndex - 1 + ease(t, 0, 1, 0, 1);
} else {
markerIndex = nearestMarkerIndex;
}
} else {
// No markers, set markerIndex to 0
markerIndex = -1;
}
// Use marker index value
markerIndex;