Slider Controls Value and the expression will output digital clock format
-Current Comp Time
timeToTimecode(t = time +thisComp.displayStartTime,timecodeBase =30,isDuration =false);
Display current time of comp.
-Current Time
var date =newDate(Date(0));var hours =now.getHours();var minutes =now.getMinutes();var seconds =now.getSeconds();hours +':'+ minutes +':'+ seconds;
Displays the current clock time of the machine it is running on
-Current Frame
timeToFrames(time,25);
Displays Current Frame, change "25" to match your frame rate
-Display Timecode, Frames & FPS
// Ensure the timeToTimecode function is called with the correct parametersvar currentTime = time;var displayStartTime =thisComp.displayStartTime;var frameRate =thisComp.frameRate;var frameDuration =thisComp.frameDuration;// Convert current time to timecodevar timeCode =timeToTimecode(currentTime + displayStartTime, frameRate,false);// Calculate the current frame numbervar frameNum = (currentTime - displayStartTime) / frameDuration;// Check if the checkboxes exist, if not create default valuesvar hideTimeCode =false;var hideFrames =false;var hideFPS =false;try { hideTimeCode = (effect("Hide Time Code")("Checkbox") >0);} catch (e) { hideTimeCode =false;}try { hideFrames = (effect("Hide Frames")("Checkbox") >0);} catch (e) { hideFrames =false;}try { hideFPS = (effect("Hide FPS")("Checkbox") >0);} catch (e) { hideFPS =false;}// Build the display string based on checkbox statesvar displayString ="";if (!hideTimeCode) { displayString += timeCode +" | ";}if (!hideFrames) { displayString +="Frame: "+Math.round(frameNum) +" | ";}if (!hideFPS) { displayString +="FPS: "+frameRate.toFixed(2);}// Return the final display stringdisplayString;
This After Effects expression displays the current timecode, frame number, and frame rate. It includes optional checkboxes to hide each element. It calculates timecode usingtimeToTimecode and ensures compatibility even if checkboxes are absent.
Updated: 17/07/24