SOURCE

console 命令行工具 X clear

                    
>
console
let wrapper = document.querySelector('.wrapper')
  let textArr = [
  '富强','民主','和谐','平等','绿化','富强','民主','和谐','平等','绿化','富强','民主','和谐','平等','绿化']


  init(16)

function init(speed){
  addText()
  //创建h1并加入文字
  function addText(){
    if(textArr.length==0)return;
    setTimeout(()=>addText(),speed*10)

    let h1 = document.createElement('h1')
    h1.innerHTML = textArr.shift()
    wrapper.appendChild(h1)
    divMove(h1)
  }

  //文字向上移动并消失
  function divMove(ele){
    let getStyle = val=>parseFloat(window.getComputedStyle(ele,null)[val])
    let count = 0
    let offsetTop = getStyle('top')
    let opac = getStyle('opacity')

    ele.timer = setInterval(()=>{

      offsetTop = getStyle('top')

      if(++count%3==0){
        opac = getStyle('opacity')
        ele.style.opacity = opac-0.1
      }

      if(offsetTop<-50){
        clearInterval(ele.timer)
        ele.remove()
      }
        ele.style.top = offsetTop-3 + 'px'
    },speed)
  }
}
<body>
  <div class="wrapper">
  </div>
</body>
*{padding:0;margin:0}
    .wrapper{
      margin:50px auto;
      position:relative;
      border:1px solid;
      overflow: hidden;
      height:100px;
      width:500px;
     
    }
    .wrapper>h1{
      position:absolute;
      top:50px;
      left:50%;
      transform:translateX(-50%);
      color:red;
    }