🖨️Display Value
Using the sourceText to show Values you wouldn't normally be able to display.
TIME
-Countdown Timer
Slider = effect("Slider Control")("Slider");
ms = Math.floor(slider/1000);
seconds = Math.floor(slider%60);
minutes = Math.floor(slider/60);
minutes = Math.floor(slider%60)
hours = Math.floor (slider/3600)
function addZero(n) {
if(n < 10) {
return '0' + n
} else {
return n;
}
}
if (slider > 0) {
addZero(hours) + ':' + addZero(minutes) + ':' + addZero(seconds) + ':' + (ms)
} else {
'00:00'
}
-Current Comp Time
timeToTimecode(t = time + thisComp.displayStartTime,
timecodeBase = 30,
isDuration = false);
-Current Time
var date = new Date(Date(0));
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
hours + ':' + minutes + ':' + seconds;
-Current Frame
timeToFrames(time,25);
-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;
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
-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;
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
Last updated