动画

  1. 持续滚动
<template>
	<div class="game-module-bg animate">
      <img src="@/assets/images/bg-2.jpg" class="img" />
      <img src="@/assets/images/bg-2.jpg" class="img" />
    </div>
</template>
<script>
export default {
methods: {
	gameAnimateFn() {
      let el = document.querySelector(".img");
      let H = document.body.clientHeight;
      let parentEl = document.querySelector(".animate");
      let initData = parseFloat(el.style.marginTop) || 0;
      let p = initData - 200;
      if (1000 > parentEl.scrollHeight + p) {
        let newImgEl = document.createElement("img");
        newImgEl.setAttribute("src", require("@/assets/images/bg-2.jpg"));
        parentEl.appendChild(newImgEl);
      }
      el.style.marginTop = p + "px";
    },
}
}
</script>
posted @ 2023-06-27 10:24  拉布拉多~  阅读(6)  评论(0编辑  收藏  举报