diff --git a/index.html b/index.html index 06c6ee2..06cd6e4 100644 --- a/index.html +++ b/index.html @@ -593,7 +593,7 @@ }, 500); } - function typeCalmly(elem, text, callback) { + function typeCalmly(elem, text, callback, minDelay, maxDelay) { let i = 0; const total = text.length; @@ -605,7 +605,9 @@ elem.textContent += text[i]; i++; const progress = i / total; - const delay = 70 + progress * progress * 130; + const dMin = minDelay || 70; + const dMax = maxDelay || 130; + const delay = dMin + progress * progress * (dMax - dMin); setTimeout(typeChar, delay); } typeChar(); @@ -767,7 +769,7 @@ }, 30); }); }, 3000); - }); + }, 20, 50); }); }, 2000); });