From 823de500d7b4df2c7d671b3a177a8402567627bb Mon Sep 17 00:00:00 2001 From: Spedon Date: Tue, 28 Mar 2023 16:59:15 +0800 Subject: [PATCH] add comments for the code --- assets/ts/desktop.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/assets/ts/desktop.ts b/assets/ts/desktop.ts index cd13423..60ac542 100644 --- a/assets/ts/desktop.ts +++ b/assets/ts/desktop.ts @@ -86,10 +86,14 @@ export const handleOnMove = (e: MouseEvent): void => { async function enterOverlay(): Promise { // stop images animation window.removeEventListener('mousemove', handleOnMove) + // get index array length const indexesNum: number = trailingImageIndexes.length for (let i = 0; i < indexesNum; i++) { + // create image element const e: HTMLImageElement = images[trailingImageIndexes[i]] + // cache images' position transformCache.push(e.style.transform) + // set style for the images if (i === indexesNum - 1) { e.style.transitionDelay = `${0.1 * i + 0.2}s, ${0.1 * i + 0.2 + 0.5}s` e.dataset.status = 'top' @@ -99,7 +103,9 @@ async function enterOverlay(): Promise { e.dataset.status = 'trail' } } + // sleep await delay(stackDepth * 100 + 100 + 1000) + // post process for (let i = 0; i < indexesNum; i++) { images[trailingImageIndexes[i]].style.transitionDelay = '' if (i === indexesNum - 1) {