|
|
组合代码不当,修改如下:
- <style>
- #papa { left: -214px; width: 1024px; height: 640px; display: grid; place-items: center; background: teal url('https://img-baofun.zhhainiao.com/pcwallpaper_ugc/live/657cfb6f72d2834fa31113c80363dfb7.mp4.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; z-index: 3; }
- #canv { position: absolute; bottom: 30px; cursor: pointer; box-reflect: below 0 linear-gradient(transparent, transparent 50%, rgba(255,255,255,.3)); -webkit-box-reflect: below 0 linear-gradient(transparent, transparent 50%, rgba(255,255,255,.3)); }
- #lrcbox { position: absolute; left: 400px; top: 480px; font: bold 30px / 40px sans-serif; color: darkgreen; text-shadow: 1px 1px 2px #000, 10px 10px 10px rgba(0, 0, 0, .35); user-select: none; }
- </style>
- <div id="papa">
- <canvas id="canv"></canvas>
- <span id="lrcbox">踏人间(DJ沈念版)</span>
- </div>
- <script>
- let ctx = canv.getContext('2d'),
- w = canv.width =450,
- h = canv.height = 100,
- lines = [],
- total = 80,
- lineWidth = (w - 2 * total) / total,
- aud = new Audio();
- let lrcAr = [
- ['0.00','裂天 - 踏人间 (DJ沈念版)'],
- ['0.64','词:孙英男'],
- ['0.96','曲:康兵辉'],
- ['1.28','OP:昌禾文化'],
- ['3.28','LRC编辑:醉美水芙蓉'],
- ['5.76','曾经故人不见应距长安远'],
- ['6.33','再回首时青山亦难见'],
- ['10.05','唯见青山不见君'],
- ['12.94','殚尽红颜如神明'],
- ['15.91','我欲踏遍人间繁华皆过眼'],
- ['19.87','快意江湖一笑泯恩怨'],
- ['23.66','我欲翩翩少年斟酒斗十千'],
- ['27.82','笙歌妙舞满堂俱欢颜'],
- ['31.72','我曾踏过人间过往梦如烟'],
- ['35.78','酒醒花残一朝战火喧'],
- ['39.72','我曾忘却尘缘似来鸿去燕'],
- ['43.69','一身轻骨何惧再拔剑'],
- ['64.37','乱世烽火狼烟塞外黄沙天'],
- ['68.37','炉上煨酒欲把旧柴添'],
- ['71.85','月下怅然无言孤衾枕难眠'],
- ['76.32','奈何岁月已是白头现'],
- ['80.14','又遇大雪寒年风霜忆旧年'],
- ['84.29','一杯浊酒化思绪万千'],
- ['87.84','曾经故人不见应距长安远'],
- ['92.21','再回首时青山亦难见'],
- ['95.87','我欲踏遍人间繁华皆过眼'],
- ['99.92','快意江湖一笑泯恩怨'],
- ['103.61','我欲翩翩少年斟酒斗十千'],
- ['107.70','笙歌妙舞满堂俱欢颜'],
- ['111.71','我曾踏过人间过往梦如烟'],
- ['115.73','酒醒花残一朝战火喧'],
- ['119.70','我曾忘却尘缘似来鸿去燕'],
- ['123.75','一身轻骨何惧再拔剑'],
- ['144.17','又遇大雪寒年风霜忆旧年'],
- ['148.28','一杯浊酒化思绪万千'],
- ['151.77','曾经故人不见应距长安远'],
- ['156.08','再回首时青山亦难见'],
- ['159.57','我欲踏遍人间繁华已过眼'],
- ['163.72','快意江湖一笑泯恩怨'],
- ['167.61','我欲翩翩少年斟酒斗十千'],
- ['171.70','笙歌妙舞满堂俱欢颜'],
- ['175.68','我曾踏过人间过往梦如烟'],
- ['179.71','酒醒花残一朝战火喧'],
- ['183.63','我曾忘却尘缘似来鸿去燕'],
- ['187.84','一身轻骨何惧再拔剑'],
- ['205.28','谢谢欣赏!']
- ];
- aud.src = 'https://www.qqmc.com/up/kwlink.php?id=223220254&.mp3';
- aud.loop = true;
- aud.autoplay = true;
- aud.addEventListener('timeupdate', () => {
- change();
- for(j=0; j<lrcAr.length; j++){
- if(aud.currentTime >= lrcAr[j][0]) lrcbox.innerHTML = lrcAr[j][1];
- }
- });
- canv.onclick = () => aud.paused ? aud.play() : aud.pause();
- function Line(x1,y1,x2,y2) {
- this.x1 = x1;
- this.y1 = y1;
- this.x2 = x2;
- this.y2 = y2;
- lines.push(this);
- }
- Line.prototype.draw = function() {
- ctx.beginPath();
- ctx.strokeStyle = this.color;
- ctx.lineWidth = lineWidth;
- ctx.moveTo(this.x1, this.y1);
- ctx.lineTo(this.x2,this.y2);
- ctx.stroke();
- }
- for(let j = 0; j < total; j ++) {
- let line = new Line();
- line.x1 = j * lineWidth + j*2 + lineWidth / 2 + 1;
- line.y1 = h;
- line.x2 = line.x1;
- line.y2 = 60;
- line.color = 'purple';
- line.draw();
- }
- function change() {
- ctx.clearRect(0,0,w,h);
- for(let item of lines) {
- item.color = '#' + Math.random().toString(16).substr(-6);
- item.y2 = h - (Math.random() * h);
- item.draw();
- }
- }
- change();
- </script>
复制代码
|
|