东篱闲人 发表于 2022-4-15 21:15

茶禅一味

<style>
      .mnBox { position: relative; display: flex; justify-content: center; align-items: center; width: 1024px; height: 700px; left: 0px;TOP:30px; perspective: 1000px; }
      .imgBox { --w: 170px; --h: 560px; position: absolute; width: var(--w); height: var(--h); cursor: pointer; transform-style: preserve-3d; }
      .imgBox img { width: var(--w); height: var(--h); position: absolute; }
      @keyframes rotate { 100% { transform: rotateY(360deg); } }
</style>

<div class="mnBox">
      <div class="imgBox"></div>
</div>

<script language="javascript">
let picAr = [
   
      "https://s1.ax1x.com/2022/04/15/LG8iM8.jpg",
      "https://s1.ax1x.com/2022/04/15/LG8NJ1.png",
         "https://s1.ax1x.com/2022/04/15/LG8Vaj.jpg",
      "https://s1.ax1x.com/2022/04/15/LG8NJ1.png",
      "https://s1.ax1x.com/2022/04/15/LG8KzV.jpg",
         "https://s1.ax1x.com/2022/04/15/LG8NJ1.png",
          "https://s1.ax1x.com/2022/04/15/LG88Z4.jpg",
      "https://s1.ax1x.com/2022/04/15/LG8NJ1.png",
      
      
];
      
let iBox = document.querySelector(".imgBox");
let hStr = "";
let angle = 360 / picAr.length;
let tz = Math.tan(Math.PI / 180 * (180 - angle) /2 ) * iBox.clientWidth / 2;
for(j=0; j<picAr.length; j++) {
      //hStr += `<div style="transform: rotateY(${angle*j}deg) translateZ(${tz}px);"><img alt="" src="${picAr}" /></div>\n`;
      hStr += `<div><img alt="" src="${picAr}" /></div>\n`;
}
iBox.innerHTML = hStr;
let au = document.createElement("audio");
au.src = "http://music.163.com/song/media/outer/url?id=465920323.mp3";
au.autoplay = true;
au.loop = true;
document.querySelector(".mnBox").appendChild(au);
iBox.onmousemove = function(){ iBox.style.animationPlayState = "paused"; }
iBox.onmouseout = function(){ iBox.style.animationPlayState = "running"; }
iBox.onclick = function() {
      au.paused ? (au.play(), this.style.animationPlayState = "running") : (au.pause(), this.style.animationPlayState = "paused");
}

setTimeout(function() {
      let children = iBox.children;
      for(j=0; j<picAr.length; j++) {
                children.style.transform = `rotateY(${angle*j}deg) translateZ(${tz}px)`;
      }
      iBox.style.animation = "rotate 30s linear infinite";
},10000);

</script>

苍野 发表于 2022-4-15 21:27

网速太卡转半天才看全乎

苍野 发表于 2022-4-15 21:27

欣赏精彩制作{:10_412:}

蜻蜓 发表于 2022-4-15 21:40

还带镂空旋转的!神了{:10_402:}
页: [1]
查看完整版本: 茶禅一味