13 lines
447 B
JavaScript
13 lines
447 B
JavaScript
{8beb218b25356ec9b0a035ebde745ee0ee630601 true 447 main.js 0xc001db31f0}
const text = document.getElementById('text');
|
|
const textArr = text.innerText.split('');
|
|
|
|
const newEl = document.createElement('h1');
|
|
newEl.innerHTML = `${textArr.map(letter => `<span class="letter" style="${randomVisibility()}">${letter}</span>`).join('')}`;
|
|
newEl.classList.add('overlay');
|
|
|
|
document.body.appendChild(newEl);
|
|
|
|
|
|
function randomVisibility() {
|
|
return Math.random() < 0.5 ? 'visibility: hidden' : 'visibility: visible';
|
|
} |