Animation 1 modification

This commit is contained in:
Thomas Smith 2023-02-28 16:28:56 -05:00
parent 4e0944f401
commit 8e64b2c917

View file

@ -1,8 +1,8 @@
<script> <script>
const commands2 = [ const commands2 = [
{ input: '$ sh <(curl https://tea.xyz)<br>################################', output: '<br><br>k, we installed /Users/thomassmith/.tea/tea.xyz/v0.24.2/bin/tea' }, { input: '$ sh <(curl https://tea.xyz)<br>##########################################', output: '<br>k, we installed /Users/thomassmith/.tea/tea.xyz/v0.24.2/bin/tea' },
{ input: `<br><br>$ tea redis-cli ping<br>################################`, output: `<br>installed: ~/.tea/redis.io/v7.0.8<br><div class="comment-success p-2" style="position:relative; top:5px;"><code class="small"><i class="icon-check-circle"></i>tea installs 'redis' automagically.</code></div>` }, { input: `<br>$ tea redis-cli ping<br>##########################################`, output: `<br>installed: ~/.tea/redis.io/v7.0.8<br><div class="comment-success p-2" style="position:relative; top:5px;"><code class="small"><i class="icon-check-circle"></i>tea installs 'redis' automagically.</code></div>` },
{ input: '', output: '<br>pong' }, { input: '', output: 'pong' },
]; ];
let commandIndex2 = 0; let commandIndex2 = 0;
@ -14,21 +14,30 @@
return; return;
} }
if (command2.input.length === 0) { if (command2.input.length === 0) {
commandOutput2 += '\n' + command2.output + '\n'; setTimeout(() => {
document.querySelector('#terminal-output-2').innerHTML = commandOutput2; commandOutput2 += '<br>' + command2.output + '<br>';
commandIndex2++; document.querySelector('#terminal-output-2').innerHTML = commandOutput2;
command2 = commands2[commandIndex2]; commandIndex2++;
setTimeout(typeCommand2, 1000); command2 = commands2[commandIndex2];
setTimeout(typeCommand2, 1000);
}, 2000);
return; return;
} }
let char = command2.input[0]; let currentChar = command2.input[0];
if (char === '$') { if (currentChar === '#') {
char = '<span class="purple">$</span>'; currentChar = '#';
const delay = 20;
setTimeout(typeCommand2, delay);
} else {
const delay = Math.floor(Math.random() * 40) + 80;
setTimeout(typeCommand2, delay);
} }
commandOutput2 += char; if (currentChar === '$') {
currentChar = '<span class="purple">$</span>';
}
commandOutput2 += currentChar;
command2.input = command2.input.slice(1); command2.input = command2.input.slice(1);
document.querySelector('#terminal-output-2').innerHTML = commandOutput2; document.querySelector('#terminal-output-2').innerHTML = commandOutput2;
setTimeout(typeCommand2, 80);
} }
const observer2 = new IntersectionObserver((entries) => { const observer2 = new IntersectionObserver((entries) => {