diff --git a/script.js b/script.js index dca9b2b..534d08a 100755 --- a/script.js +++ b/script.js @@ -99,14 +99,20 @@ var convo = pick(convos); var avs = ['av-a', 'av-b', 'av-c']; var html = ''; + var delay = 0.8; + var lastDelay = 0.8; for (var k = 0; k < convo.length; k++) { var speaker = convo[k][0]; - html += '
' + + lastDelay = delay; + html += '
' + '' + '
' + chosenNames[speaker] + '

' + convo[k][1] + '

' + '
'; + delay += 1.8 + Math.random() * 1.4; } html += '
'; chat.innerHTML = html; + var typing = chat.querySelector('.typing'); + if (typing) typing.style.animationDelay = (lastDelay + 1.8).toFixed(2) + 's'; } })(); diff --git a/styles.css b/styles.css index 2372f2c..74a072e 100644 --- a/styles.css +++ b/styles.css @@ -275,7 +275,7 @@ main { .mock-body { display: grid; grid-template-columns: 56px 170px 1fr; - height: 360px; + min-height: 360px; } .mock-servers { @@ -338,9 +338,11 @@ main { } .msg b { font-size: 0.85rem; } .msg p { margin: 0.1rem 0 0; font-size: 0.85rem; color: var(--muted); } -.msg-1 { animation-delay: 0.4s; } -.msg-2 { animation-delay: 1.4s; } -.msg-3 { animation-delay: 2.4s; } +.msg-1 { animation-delay: 0.8s; } +.msg-2 { animation-delay: 2.8s; } +.msg-3 { animation-delay: 4.8s; } +.msg-4 { animation-delay: 6.8s; } +.msg-5 { animation-delay: 8.8s; } @keyframes msg-in { to { opacity: 1; transform: translateY(0); } @@ -364,7 +366,7 @@ main { border-radius: 999px; background: var(--surface-2); opacity: 0; - animation: fade-in 0.4s 3.4s forwards; + animation: fade-in 0.4s 6.5s forwards; } .typing span { width: 6px;