Time line format time data

Hi!
I'd like to get a format time data from: symbolInstance.currentTimeInTimelineNamed(timelineName) like "00:03,06" instead of decimal number and
I'd like to specify a format time data to: symbolInstance.goToTimeInTimelineNamed(timeInSeconds, timelineName), like "00:03,06" instead of decimal number.

Can you help me please?
Thanks a lot!!

use: Extend Tumult Hype with JavaScript: hypeDocument.extensions - #29 by MaxZieb

or make a feature request :wink:

1 Like

I've filed this on our tracker to support string timecodes.

Perhaps stating the obvious, but you can use a bit of math to achieve the desired result of SECONDS + (FRAMES / 30) since Hype's default timecode is 30 fps. So your "00:03,06" example would be 30 + (6/30).

If you use the Extension here is the reverse function for it:

/**
 * hypeDocument.secondsToTimeIndex 1.0
 * @param {Number} seconds
 * @param {String} format (optional)
 */
hypeDocument.secondsToTimeIndex = function(sec, format) {
    var min = 0,
        frm = 0,
        FPS = 30;
    min = Math.floor(sec / 60);
    sec = sec % 60;
    frm = Math.floor((sec - Math.floor(sec)) * FPS);
    if (format === 'object') {
        return {
            'minutes': min,
            'seconds': Math.floor(sec),
            'frames': frm,
            'FPS': FPS
        };
    } else if (format === 'number') {
        return sec + frm / FPS;
    } else {
        return min + ':' + Math.floor(sec) + '.' + frm;
    }
}