Here’s a script to do this, which writes values into elements with these IDs timecode & timecodeWithFrames
// Run this every 100 milliseconds
window.setInterval(function(){
// Gets the raw timecode in seconds and fractions of a second
var timecodevalue = hypeDocument.currentTimeInTimelineNamed('Main Timeline');
// Hype shows 30 frames per second
var fps = 30;
var seconds = Math.floor(timecodevalue);
var minutes = Math.floor(seconds / 60);
// This subtracts the value in seconds from the raw timecode value and converts it to a two number with no decimal points.
var frames = ((timecodevalue - seconds) * 30).toFixed(0);
// Raw number of seconds:
document.getElementById("timecode").innerHTML = timecodevalue;
// Seconds + Frames
// document.getElementById("timecodeWithFrames").innerHTML = seconds.toString() + ' ' + frames.toString();
document.getElementById("timecodeWithFrames").innerHTML = minutes + ' ' + seconds + ' ' + frames;
}, 100);
Hi Daniel,
I try to work with your script. The Timeline in hype is at 01: 08.00. Output in the browser is 1 68 0. I can not find a solution for the correct hour.
I’ve also tried this, but it doesn’t work! ( = hours + ’ ’ )
I google’d a bit of this code ( to lazy to re work it out again… and incorporated it here to get you what you want. Which is to have the seconds only count to 59
// Run this every 100 milliseconds
window.setInterval(function(){
// Gets the raw timecode in seconds and fractions of a second
var timecodevalue = hypeDocument.currentTimeInTimelineNamed('Main Timeline');
// Hype has 30 frames a second
var fps = 30;
var totalSeconds = Math.floor(timecodevalue);
var hours = Math.floor(totalSeconds /3600);
var minutes = Math.floor((totalSeconds - hours*3600)/60);
var seconds = totalSeconds - (hours*3600 + minutes*60);
// This subtracts the value in seconds from the raw timecode value and converts it to a two number with no decimal points.
var frames = ((timecodevalue - totalSeconds) * 30).toFixed(0);
// Raw number of seconds:
document.getElementById("timecode").innerHTML = timecodevalue;
// Seconds + Frames
// document.getElementById("timecodeWithFrames").innerHTML = seconds.toString() + ' ' + frames.toString();
document.getElementById("timecodeWithFrames").innerHTML = hours + ' : ' + minutes + ' : ' + seconds + ' : ' + frames;
}, 100);