From cb6a2ddb36d27abd12a6d0b9aa493194d4c242a2 Mon Sep 17 00:00:00 2001 From: "caleb.mabry.15@cnu.edu" Date: Tue, 8 Mar 2022 23:08:13 -0500 Subject: ESLint --- webAO/utils/calculateWebpLength.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'webAO/utils/calculateWebpLength.js') diff --git a/webAO/utils/calculateWebpLength.js b/webAO/utils/calculateWebpLength.js index 38da7c1..1b422a0 100644 --- a/webAO/utils/calculateWebpLength.js +++ b/webAO/utils/calculateWebpLength.js @@ -1,22 +1,22 @@ const calculateWebpLength = (webpFile) => { - let d = new Uint8Array(webpFile); + const d = new Uint8Array(webpFile); // https://developers.google.com/speed/webp/docs/riff_container#animation let duration = 0; - for (var i = 0; i < d.length; i++) { + for (let i = 0; i < d.length; i++) { // Find ANMF header (41 4E 4D 46) if (d[i] === 0x41 && d[i + 1] === 0x4E && d[i + 2] === 0x4D && d[i + 3] === 0x46) { // Swap 5th and 6th bytes to get the delay per frame - let delay = (d[i + 21] << 8) | (d[i + 20] & 0xFF); + const delay = (d[i + 21] << 8) | (d[i + 20] & 0xFF); - // Should be aware browsers have a minimum frame delay + // Should be aware browsers have a minimum frame delay // e.g. 6ms for IE, 2ms modern browsers (50fps) duration += delay < 2 ? 10 : delay; } } return duration; -} +}; -export default calculateWebpLength \ No newline at end of file +export default calculateWebpLength; -- cgit