12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- const spinner = {
- interval:80,
- frames:[
- "[ ]",
- "[= ]",
- "[== ]",
- "[=== ]",
- "[==== ]",
- "[===== ]",
- "[ ===== ]",
- "[ ===== ]",
- "[ =====]",
- "[ ====]",
- "[ ===]",
- "[ ==]",
- "[ =]",
- "[ ]",
- "[ =]",
- "[ ==]",
- "[ ===]",
- "[ ====]",
- "[ =====]",
- "[ ===== ]",
- "[ ===== ]",
- "[===== ]",
- "[==== ]",
- "[=== ]",
- "[== ]",
- "[= ]"]
- }
- function loader() {
- const grid = document.getElementById('loader')
- const spin = document.createElement('div');
- spin.innerText = spinner.frames[0];
- grid.appendChild(spin);
- let i = 0;
- return setInterval(() => {
- requestAnimationFrame(() => {
- spin.innerHTML = spinner.frames[++i % spinner.frames.length];
- });
- }, spinner.interval);
- }
|