var date = new Date(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 parameters
var currentTime = time;
var displayStartTime = thisComp.displayStartTime;
var frameRate = thisComp.frameRate;
var frameDuration = thisComp.frameDuration;
// Convert current time to timecode
var timeCode = timeToTimecode(currentTime + displayStartTime, frameRate, false);
// Calculate the current frame number
var frameNum = (currentTime - displayStartTime) / frameDuration;
// Check if the checkboxes exist, if not create default values
var 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 states
var displayString = "";
if (!hideTimeCode) {
displayString += timeCode + " | ";
}
if (!hideFrames) {
displayString += "Frame: " + Math.round(frameNum) + " | ";
}
if (!hideFPS) {
displayString += "FPS: " + frameRate.toFixed(2);
}
// Return the final display string
displayString;
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
COLOR
-Display RGB Code
//Print RGB Value
theColor = thisComp.layer("Color Style").effect("Color 1")("Color");
r = Math.round(theColor[0]*255)
g = Math.round(theColor[1]*255)
b = Math.round(theColor[2]*255)
"r,"+r +" g,"+g+" b,"+b
Displays RGB Code in Source Text
-Display Hex Code
//Print Hex Value
theColor = thisComp.layer("Color Style").effect("Color 1")("Color");
r = Math.round(theColor[0]*255).toString(16)
g = Math.round(theColor[1]*255).toString(16)
b = Math.round(theColor[2]*255).toString(16)
"#"+r+g+b;
Displays Hex Code in Source Text
Refrence
-Display Nearest Marker Comment
m = thisComp.layer("Marker Layer").marker;
txt = "";
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
if (n > 0) txt = m.key(n).comment;
}
txt