加林森 发表于 2022-7-16 18:04

《羌笛》- 云朵 (根据老黑人间天堂制作)

本帖最后由 加林森 于 2022-7-16 19:57 编辑 <br /><br /><style>
#papa { left: -302px; width: 1200px; height: 750px; background: #000 url('https://pic.imgdb.cn/item/62d28428f54cd3f937d78a12.jpg') no-repeat; perspective: 3000px; box-shadow: 3px 3px 20px #000; display: flex; justify-content: center; align-items: center; border-radius: 6px; position: relative; }
#mypic { position: absolute; width: 600px; height: 600px; box-shadow: inherit; transform-style: preserve-3d; transition: all 6s linear; }
#mypic>img { width: 100%; height: 100%; opacity: .9; }
#papa p { margin: 0; padding: 0; }
#papa input { border: none; outline: none; opacity: .75; cursor: pointer; }
#playbox { position: absolute; left: 50px; bottom: 20px; padding: 10px; font: normal 1em sans-serif; color: #eee; background: rgba(255,255,255,.2); border-radius: 8px; backdrop-filter: blur(1px); overflow: hidden; box-shadow: 1px 1px 2px rgba(0,0,0,.15); z-index: 100; }
#btnplay { width: 30px; height: 30px; border-radius: 50%; }
#btnplay:hover { background: #aaa; color: #ff0000; }
</style>

<div id="papa">
      <div id="mypic"><img id="myImg" src="https://pic.imgdb.cn/item/62d28562f54cd3f937d94967.jpg" alt="" /></div>
      <div id="playbox">
                <p id="geci" style="font-size: 1.2em; text-shadow: 1px 1px 1px #222">LRC Loading ... </p>
                <p style="display: flex; align-items: center; gap: 4px; margin-top: 10px;">
                        <input id="btnplay" type="button" value=">" />
                        <input id="slider" type="range" min="0" max="100" value="0" />
                        <span id="per">0%</span>
                </p>
      </div>
      <audio id="aud" src="https://music.163.com/song/media/outer/url?id=325594.mp3" autoplay="autoplay" loop="loop"></audio>
</div>

<script>
let picAr = [
      'https://pic.imgdb.cn/item/62d28562f54cd3f937d94967.jpg',
      'https://pic.imgdb.cn/item/62d28608f54cd3f937da3c43.jpg',
      'https://pic.imgdb.cn/item/62d28688f54cd3f937dae83b.jpg',
      'https://pic.imgdb.cn/item/62d2872df54cd3f937dbbf0c.jpg',
      'https://pic.imgdb.cn/item/62d287d3f54cd3f937dcacd9.jpg',
      'https://pic.imgdb.cn/item/62d288e3f54cd3f937de389f.jpg',
      'https://pic.imgdb.cn/item/62d2897bf54cd3f937df082c.jpg',
      'https://pic.imgdb.cn/item/62d289f8f54cd3f937dfb7be.jpg'
];
let lrcAr = [
      ['0.00','羌笛 - 云朵'],
      ['290.00','谢谢欣赏']
];
let idx = 0;
let num = (min, max) => Math.floor(Math.random() * (max-min+1)) + min;

setTimeout(setAni(), 3000);

slider.onmousedown = () => aud.pause();
slider.onchange = () => { aud.currentTime = slider.value * aud.duration / 100; aud.play(); }
btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
aud.addEventListener('playing', () => btnplay.value = '||');
aud.addEventListener('pause', () => btnplay.value = '>');

aud.addEventListener('timeupdate', () => {
      let prog = 100 * aud.currentTime / aud.duration;
      slider.value = prog;
      per.innerText = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);
      for(j=0; j<lrcAr.length; j++){
                if(aud.currentTime >= lrcAr) geci.innerHTML = lrcAr;
      }
});

let toMin = (val) => {
      if(!val) return '0:0';
      val = Math.floor(val);
      return parseInt(val / 60) + ':' +parseFloat(val % 60);
}

function setAni() {
      let xx = num(-60,60), yy = num(-60,60), zz = num(-120,120);
      aniRot(mypic,xx,yy,zz);
      chgPic();
      setTimeout(setAni,10000);
}

function aniRot(ele,x,y,z) {
      ele.style.transform = `rotateX(${x}deg) rotateY(${y}deg) rotateZ(${z}deg)`;
}

function chgPic() {
      idx = num(0, picAr.length - 1);
      myImg.src = picAr;
}
</script>

加林森 发表于 2022-7-16 18:04

@马黑黑

马黑黑 发表于 2022-7-16 18:05

这次速度快而质量高。队长厉害,赞。

加林森 发表于 2022-7-16 18:12

马黑黑 发表于 2022-7-16 18:05
这次速度快而质量高。队长厉害,赞。

谢谢你发出来的代码共享。我就去找了云朵唱的歌曲,就制作出来了。{:5_108:}

马黑黑 发表于 2022-7-16 18:15

加林森 发表于 2022-7-16 18:12
谢谢你发出来的代码共享。我就去找了云朵唱的歌曲,就制作出来了。

素材的准备也是要花时间的

加林森 发表于 2022-7-16 18:19

马黑黑 发表于 2022-7-16 18:15
素材的准备也是要花时间的

是的。。一边制作一边找图,然后再去上传。就这样制作出来了。一个多小时间。

马黑黑 发表于 2022-7-16 18:40

加林森 发表于 2022-7-16 18:19
是的。。一边制作一边找图,然后再去上传。就这样制作出来了。一个多小时间。

动作够快了,我一般要三天才能做好

加林森 发表于 2022-7-16 18:53

本帖最后由 加林森 于 2022-7-16 19:01 编辑

马黑黑 发表于 2022-7-16 18:40
动作够快了,我一般要三天才能做好

我这个主要靠你的代码制作的,当然就快了。

小辣椒 发表于 2022-7-16 20:57

队长今天的黑黑新分享的?我还没有看见黑黑的教程的,队长速度的{:4_178:}

加林森 发表于 2022-7-16 21:36

小辣椒 发表于 2022-7-16 20:57
队长今天的黑黑新分享的?我还没有看见黑黑的教程的,队长速度的

就是今天发出来的。
页: [1]
查看完整版本: 《羌笛》- 云朵 (根据老黑人间天堂制作)