mirror of
https://github.com/web3privacy/w3ps1.git
synced 2024-10-15 16:26:26 +02:00
Fix animation
This commit is contained in:
parent
d8a3cd1063
commit
2c3abc1ece
1 changed files with 5 additions and 2 deletions
|
@ -21,12 +21,15 @@ export function animateText (ev) {
|
|||
const orig = ev.target.getAttribute('data-text')
|
||||
const steps = orig.length
|
||||
|
||||
const random = rand(orig.length)
|
||||
const genRand = (pos = 0, len = null) => orig.substring(pos, len).split(' ').map(x => rand(x.length)).join(' ')
|
||||
const random = genRand(0, orig.length)
|
||||
|
||||
ev.target.innerHTML = random
|
||||
|
||||
for (let i = 0; i <= steps; i++) {
|
||||
setTimeout(() => {
|
||||
ev.target.innerHTML = orig.substring(0, i) + rand(orig.length - i)
|
||||
ev.target.innerHTML = orig.substring(0, i) + genRand(i, orig.length)
|
||||
console.log(ev.target.innerHTML)
|
||||
|
||||
if (i === steps) {
|
||||
ev.target.setAttribute('data-animate', "0")
|
||||
|
|
Loading…
Reference in a new issue