马黑黑 发表于 2022-6-30 22:30

加林森 发表于 2022-6-30 21:54
谢茶!

{:5_108:}

加林森 发表于 2022-6-30 22:42

本帖最后由 加林森 于 2022-8-9 23:19 编辑 <br /><br />2022-6-30 22:30

{:5_108:}

<style>
#papa { left: -214px; width: 1024px; height: 640px; box-shadow: 3px 3px 20px #000; position: relative; }
#canv { position: absolute; width: 100%; height: 100%; background: #000; }
#bgImg { display: none; }
#disc { position: absolute; width: 40px; height: 40px; left: 10px; top: 10px; background: conic-gradient(red,orange,yellow,green,teal,blue,purple); mask: radial-gradient(transparent 4px,red 0); -webkit-mask: radial-gradient(transparent 4px,red 0); border-radius: 50%; cursor: pointer; animation: rot 2s linear infinite; }
#tit { position: absolute; left: 60px; top: 10px;font: bold 22px / 40px sans-serif; color: snow; text-shadow: 2px 2px 4px black; }
@keyframes rot { to { transform: rotate(360deg); } }
</style>

<div id="papa">
      <canvas id="canv"></canvas>
      <img id="bgImg" src="https://s1.ax1x.com/2022/08/09/v1Dv1P.jpg" alt="" />
      <span id="disc"></span>
      <span id="tit">尽欢| 尕仔Music</span>
</div>

<script>
let ctx = canv.getContext('2d');
let w = papa.clientWidth, h = papa.clientHeight, aud = new Audio();
let dotAr = Array.from({length: 250}, (item,key) => { return { x: Math.random()*w, y: Math.random()*h, r: Math.random()*5, }; });

canv.width = w;
canv.height = h;
aud.src = 'https://music.163.com/song/media/outer/url?id=1910702837.mp3';
aud.loop = true;
aud.autoplay = true;

disc.style.animationPlayState = aud.paused ? 'paused' : 'running';
disc.onclick = () => aud.paused ? aud.play() : aud.pause();
aud.addEventListener('playing',()=> disc.style.animationPlayState = 'running');
aud.addEventListener('pause',()=> disc.style.animationPlayState = 'paused');

function draw() {
      ctx.clearRect(0,0,w,h);
      ctx.drawImage(bgImg, 0, 0, w, h);
      ctx.beginPath();
      for(item of dotAr) {
                ctx.fillStyle = 'rgba(255,255,255,.35)';
                ctx.moveTo(item.x, item.y);
                ctx.arc(item.x, item.y, item.r, 0, Math.PI * 2);
      }
      ctx.fill();
      update();
}

function update() {
      for (key in dotAr) {
                dotAr.y -= (7 - dotAr.r) / 10;
                if(dotAr.y < 0) {
                        dotAr = {
                              x: Math.random() * w,
                              y: h,
                              r: Math.random()*5,
                        }
                }
      }
}

draw();
setInterval(draw,10);
</script>

辫子哥哥 发表于 2022-7-1 00:08

手机一放大美女就不见了

加林森 发表于 2022-7-1 08:14

辫子哥哥 发表于 2022-7-1 00:08
手机一放大美女就不见了

可以看见的哦。我现在就是手机看的。

红影 发表于 2022-7-1 15:31

加林森 发表于 2022-6-30 20:28
好看不?

那个气泡很好看{:4_204:}

加林森 发表于 2022-7-1 15:56

红影 发表于 2022-7-1 15:31
那个气泡很好看

大小正合适。

红影 发表于 2022-7-1 16:51

加林森 发表于 2022-7-1 15:56
大小正合适。

是的{:4_204:}

加林森 发表于 2022-7-1 17:17

红影 发表于 2022-7-1 16:51
是的

我看了几次才发出来的。
页: 1 [2]
查看完整版本: 《草原请你来》- 龚玥 (根据老黑的教程制作)