Last active
April 21, 2023 14:42
-
-
Save rnmeow/f0f01730524dadc429c9d1a41219644c to your computer and use it in GitHub Desktop.
Modern JavaScript code of music timer for Adobe After Effects.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 1. Timer */ | |
function padZero (n) { | |
if (n < 10) return '0' + n; | |
else return n.toString() | |
} | |
t = Math.floor(Math.max((time - inPoint), 0)); | |
min = Math.floor((t % 3600) / 60); | |
sec = padZero(Math.floor(t % 60)); | |
`${min}:${sec}` | |
/* 2. Timer with 2-digit Milisecond */ | |
function padZero (n) { | |
if (n < 10) return '0' + n; | |
else return n.toString(); | |
} | |
t = Math.floor(Math.max((time - inPoint), 0)); | |
min = Math.floor((t % 3600) / 60); | |
sec = padZero(Math.floor(t % 60)); | |
ms = Math.max(time - inPoint, 0).toFixed(2).substr(-2); | |
`${min}:${sec}.${ms}` | |
/* 3. Timer with Hour */ | |
function padZero (n) { | |
if (n < 10) return '0' + n; | |
else return n.toString(); | |
} | |
t = Math.floor(time - inPoint); | |
hr = padZero(Math.floor(t / 3600)); | |
min = padZero(Math.floor((t % 3600) / 60)); | |
sec = padZero(Math.floor(t % 60)); | |
`${hr}:${min}:${sec}` | |
/* 4. Timer Countdown */ | |
const TOTALTIME = 200; // Modify this value! (unit: seconds) | |
function padZero (n) { | |
if (n < 10) return '0' + n; | |
else return '' + n; | |
} | |
let t; | |
t = Math.floor(Math.max(TOTALTIME + -1 * (time - inPoint), 0)); | |
let min, sec; | |
min = Math.floor((t % 3600) / 60); | |
sec = padZero(Math.floor(t % 60)); | |
`-${min}:${sec}` | |
/* 5. Timer Countdown with 2-digit Milisecond */ | |
const TOTALTIME = 200; // Modify this value! (unit: seconds) | |
function padZero (n) { | |
if (n < 10) return '0' + n; | |
else return '' + n; | |
} | |
let t; | |
t = Math.floor(Math.max(TOTALTIME + -1 * (time - inPoint), 0)); | |
let min, sec; | |
min = Math.floor((t % 3600) / 60); | |
sec = padZero(Math.floor(t % 60)); | |
ms = Math.max(100 - (time - inPoint), 0).toFixed(2).substr(-2); | |
`-${min}:${sec}.${ms}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment