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>
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: `<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: '', output: '<br>pong' },
{ input: '$ sh <(curl https://tea.xyz)<br>##########################################', output: '<br>k, we installed /Users/thomassmith/.tea/tea.xyz/v0.24.2/bin/tea' },
{ 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: 'pong' },
];
let commandIndex2 = 0;
@ -14,21 +14,30 @@
return;
}
if (command2.input.length === 0) {
commandOutput2 += '\n' + command2.output + '\n';
document.querySelector('#terminal-output-2').innerHTML = commandOutput2;
commandIndex2++;
command2 = commands2[commandIndex2];
setTimeout(typeCommand2, 1000);
setTimeout(() => {
commandOutput2 += '<br>' + command2.output + '<br>';
document.querySelector('#terminal-output-2').innerHTML = commandOutput2;
commandIndex2++;
command2 = commands2[commandIndex2];
setTimeout(typeCommand2, 1000);
}, 2000);
return;
}
let char = command2.input[0];
if (char === '$') {
char = '<span class="purple">$</span>';
let currentChar = command2.input[0];
if (currentChar === '#') {
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);
document.querySelector('#terminal-output-2').innerHTML = commandOutput2;
setTimeout(typeCommand2, 80);
}
const observer2 = new IntersectionObserver((entries) => {