绿叶清舟 发表于 2022-9-30 21:42

共祝祖国繁荣富强

本帖最后由 绿叶清舟 于 2022-10-1 10:54 编辑 <br /><br /><style>
#papa { left: -250px; width: 1100px; height: 1300px; background: gray url('https://pic1.imgdb.cn/item/6336ed3c16f2c2beb1bf02f2.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; }
#tree { position: absolute; left: 280px; top: 400px; width: 600px; mix-blend-mode: multiply; clip-path: inset(60px 0px 150px 0px);}
#canv { position: absolute; }
#disc { position: absolute; width: 40px; height: 40px; left: 10px; bottom: 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; }
#lrcbox { position: absolute; left: 60px; bottom: 10px;font: bold 22px / 40px sans-serif; color: #fd330b; text-shadow: 1px 1px 2px #222; }
@keyframes rot { to { transform: rotate(360deg); } }
</style>

<div id="papa">
      <img id="tree" src="https://t9.baidu.com/it/u=3439264716,1629802886&fm=193" alt="" />
      <span id="lrcbox">国家-祝福祖繁荣昌盛</span>
      <canvas id="canv"></canvas>
      <span id="disc"></span>
</div>

<script>
(function() {
      let num = (min, max) => Math.floor(Math.random() * (max-min+1)) + min;
      let ctx = canv.getContext('2d');
      let w = canv.width = papa.offsetWidth, h = canv.height = papa.offsetHeight, particles = [], idx = 0, aud = new Audio();
      
      aud.src = 'http://music.163.com/song/media/outer/url?id=106024.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');

      canv.onclick = function(event) {
                let x = event.offsetX || event.layerX, y = event.offsetY || event.layerY;
                createParticle(x, y);
      }

      function createParticle(x, y) {
                let count = 100, radius = 10;
                for (let j = 0; j < count; j ++) {
                        let p = {};
                        let angle = 360 / count * j, radian = Math.PI / 180 * angle;
                        p.radius = radius;
                        p.startX = x;
                        p.startY = y;
                        p.radian = radian;
                        p.rgb = `${num(235,230,87)},${num(248,255,3)},${num(235,230,87)},`;
                        p.alpha = (Math.floor(Math.random() * 101)) / 100;
                        p.speed = (Math.random() * 5) + 0.4;
                        p.radius = p.speed;
                        particles.push(p);
                }
      }

      function drawParticle() {
                ctx.fillStyle = 'transparent';
                ctx.fillRect(0, 0, w, h);
                for (let j = 0; j < particles.length; j++) {
                        let p = particles;
                        let resultX = Math.cos(p.radian) * p.radius;
                        let resultY = Math.sin(p.radian) * p.radius + 0.4;
                        p.startX += resultX;
                        p.startY += resultY;
                        p.radius *= 1 - p.speed / 100;
                        p.alpha -= 0.005;
                        if (p.alpha <= 0) {
                              particles.splice(j, 1);
                              continue;
                        }
                        ctx.beginPath();
                        ctx.arc(p.startX, p.startY, .8, 0, 360, false);
                        ctx.closePath();
                        ctx.fillStyle = 'rgba(' + p.rgb + p.alpha + ')';
                        ctx.fill();
                }
      }

      function fade() {
                ctx.globalCompositeOperation = 'destination-out';
                ctx.fillStyle = 'rgba(0, 0, 0, .1)';
                ctx.fillRect(0, 0, w, h);
                ctx.globalCompositeOperation = 'lighter';
      }

      function render() {
                idx ++;
                fade();
                drawParticle();
                if(idx > 20) {
                        createParticle(Math.random() * w, Math.random() * h/2);
                        idx = 0;
                }
                requestAnimationFrame(render);
      }

      render();
})();
</script>

红影 发表于 2022-9-30 22:01

这个做得漂亮,红红火火的,如同我们的未来{:4_187:}

红影 发表于 2022-9-30 22:02

清舟可以用代码把那个文字裁剪一下,就没有下面那个小LOGO了{:4_173:}

豆儿 发表于 2022-9-30 22:15

喜气洋洋,大红的祝福,祝福祖国,明天更美好

马黑黑 发表于 2022-10-1 07:46

喜庆,吉祥

梦油 发表于 2022-10-1 09:08

祝福伟大祖国繁荣富强!祝福花潮朋友幸福安康!祝福绿叶清舟朋友节日快乐!

绿叶清舟 发表于 2022-10-1 19:29

梦油 发表于 2022-10-1 09:08
祝福伟大祖国繁荣富强!祝福花潮朋友幸福安康!祝福绿叶清舟朋友节日快乐!

谢谢梦油,祖国强盛才有咱的好日子了

绿叶清舟 发表于 2022-10-1 19:29

马黑黑 发表于 2022-10-1 07:46
喜庆,吉祥

节日快乐

绿叶清舟 发表于 2022-10-1 19:29

豆儿 发表于 2022-9-30 22:15
喜气洋洋,大红的祝福,祝福祖国,明天更美好

谢谢豆儿,节日快乐

绿叶清舟 发表于 2022-10-1 19:30

红影 发表于 2022-9-30 22:02
清舟可以用代码把那个文字裁剪一下,就没有下面那个小LOGO了

改了,这个图片特别提示了产权,脑子一别老,就没去动了{:4_189:}

红影 发表于 2022-10-1 20:20

绿叶清舟 发表于 2022-10-1 19:30
改了,这个图片特别提示了产权,脑子一别老,就没去动了

只要画面漂亮就好,管它那么多呢{:4_173:}

梦油 发表于 2022-10-2 09:53

绿叶清舟 发表于 2022-10-1 19:29
谢谢梦油,祖国强盛才有咱的好日子了

是的,清舟朋友。大河有水小河满,大河无水小河干。
页: [1]
查看完整版本: 共祝祖国繁荣富强