如何使它在没有按钮的情况下自动显示文本?

how to make this automatically reveal the text without the button?

如何在不播放按钮的情况下制作下面的动画来显示文本? 谢谢。


const reveal = document.querySelector('.reveal-wrapper')

const playBtn = document.querySelector('.play')

playBtn.addEventListener('click', () => {
reveal.classList.add('reveal-wrapper-ani')
setTimeout(() => {
 reveal.classList.remove('reveal-wrapper-ani')
}, 1000)
})

您只需删除事件侦听器并将其操作应用于加载脚本:

const reveal = document.querySelector('.reveal-wrapper')

reveal.classList.add('reveal-wrapper-ani')
setTimeout(() => {
 reveal.classList.remove('reveal-wrapper-ani')
}, 1000)