冰心 发表于 2023-7-23 20:18

【梦之大】

<style>
#papa { margin: 100px 0 0 calc(50% - 500px); width: 1080px; height: 608px; display: grid; place-items: center; background: gray url('https://img.52z.com/upload/20170621/1498024166822773.gif') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; opacity: 1; user-select: none; overflow: hidden; z-index: 1; }
#pic { position: absolute; left: 0px; top:60px; width: 450px; height: 300px; background: url('https://docimg7.docs.qq.com/image/AgAAC6u-TVMBzEnJMIxIAp80zcbMjuNG.png'); animation: sh 6s infinite alternate; z-index: 11; }
@keyframes sh { 0%,100%{ opacity: 1; } 50%{ top:80px; left:-30px; opacity: 0.1; } }
</style>

<div id="papa">
<div id="pic"></div>
        <audio id="aud" src="https://www.joy127.com/url/105690.mp3" autoplay loop></audio>
</div>

<script>
(function() {
      (function(mkPlayer) {let defaults = {lrcAr: [],lrc_css: 'top: 15px; left: 50%; transform: translate(-50%)',player_css: 'bottom: 10px; left: 50%; transform: translate(-50%)',playerCode: `<style>#mplayer { --ww: 300px; --color1: hsla(0,80%,50%,.95); --color2: hsla(0,0%,95%,.45); position: absolute; z-index: 901; }#lrc { --motion: cover2; --tt: 1s; --state: running; --bg: linear-gradient(180deg,hsla(100,10%,50%,.75),hsla(100,100%,20%,.65)); position: absolute; font: bold 2.4em sans-serif; color: hsl(100, 100%, 90%); white-space: pre; -webkit-background-clip: text; filter: drop-shadow(1px 1px 2px hsla(0, 100%, 0%, .85)); z-index: 900; }#lrc::before { position: absolute; content: attr(data-lrc); width: 20%; height: 100%; color: transparent; overflow: hidden; white-space: pre; background: var(--bg); filter: inherit; -webkit-background-clip: text; animation: var(--motion) var(--tt) linear forwards; animation-play-state: var(--state); }@keyframes cover1 { from { width: 0; }to { width: 100%; } }@keyframes cover2 { from { width: 0; }to { width: 100%; } }</style><canvas id="mplayer" width="300" height="75"></canvas><div id="lrc" data-lrc="HCPlayer">HCPlayer</div>`,};let playCode = (user_config) => {let data = Object.assign({}, defaults, user_config);papa.innerHTML += data.playerCode;mplayer.style.cssText += data.player_css;lrc.style.cssText += data.lrc_css;let mKey = 0, mFlag = true, btfFlag = false;let getCssVal = (e,v) => getComputedStyle(e).getPropertyValue(v);let ctx = mplayer.getContext('2d');let w = mplayer.width = getCssVal(mplayer,'--ww').replace(/[^0-9]/ig,''), h = mplayer.height = 75;let btnFlag = false;let player = {prog: 0,track: w,color: ,cur: '00:00',dur: '00:00'};let drawCircle = (x,y,r,color) => {ctx.beginPath();ctx.strokeStyle = color;ctx.lineWidth = 2;ctx.arc(x,y,r,0,2*Math.PI);ctx.stroke();};let drawTriangle = (x,y,len,color) => {ctx.beginPath();ctx.fillStyle = color;ctx.moveTo(x,y);ctx.lineTo(x, y+len);ctx.lineTo(x+len, y + len/2);ctx.lineTo(x,y);ctx.fill();};let drawRect = (x,y,ww,hh,color) => {ctx.beginPath();ctx.fillStyle = color;ctx.fillRect(x,y,ww,hh);};let drawOsc = (w1,w2) => {ctx.beginPath();ctx.lineWidth = 1;ctx.strokeStyle = player.color;let slice = 1, tt1 = Math.round(w1/slice), tt2 = Math.round(w2/slice);for(j=0; j<=tt2; j++) {ctx.lineTo(j*slice, Math.random() *30);}ctx.stroke();ctx.beginPath();ctx.strokeStyle = player.color;for(j=tt2; j<tt1; j++) {ctx.lineTo(j*slice, Math.random() *30);}ctx.stroke();};let drawTxt = (text,x,y,align,color) => {ctx.beginPath();ctx.font = '16px sans-serif';ctx.textAlign = align;ctx.textBaseline = 'middle';ctx.fillStyle = color;ctx.fillText(text,x,y);};let btnRender = () => {let btnColor = btnFlag ? player.color : player.color;ctx.clearRect(w/2-18, h-38, 36, 36);drawCircle(w/2,h-20,16,btnColor);aud.paused ? drawTriangle(w/2-6,h-28,16,btnColor) : (drawRect(w/2-6, h-28,4,16,btnColor), drawRect(w/2+2, h-28,4,16,btnColor));};let drawAll = () => {ctx.clearRect(0,0,w,h);drawOsc(w,player.prog);drawTxt(player.cur,w/2-26,h-20,'right',player.color);drawTxt(player.dur,w/2 + 26,h-20,'left',player.color);btnRender();};let overBtn = (e) => Math.sqrt((e.offsetX-w/2) ** 2 + (e.offsetY-(h-20)) ** 2) < 16;let overProg = (e) => e.offsetY > 0 && e.offsetY < 30;mplayer.onmousemove = (e) => {mplayer.style.cursor = overBtn(e) || overProg(e) ? 'pointer' : 'default';mplayer.title = overProg(e) ? toMin(e.offsetX*aud.duration/w) : '';overBtn(e) ? (btnFlag = true,btnRender()) : (btnFlag = false,btnRender());};mplayer.onclick = (e) => {if(overBtn(e)) { aud.paused ? aud.play() : aud.pause(); drawAll(); }if(overProg(e)) aud.currentTime = aud.duration * e.offsetX / w;};mplayer.onmouseout = () => { btnFlag = false; btnRender(); };aud.addEventListener('timeupdate', () => {player.prog = aud.currentTime * w /aud.duration;player.cur = toMin(aud.currentTime);player.dur = toMin(aud.duration);drawAll();for (j = 0; j < data.lrcAr.length; j++) {if (aud.currentTime >= data.lrcAr) {if (mKey === j) showLrc(data.lrcAr);else continue;}}});aud.addEventListener('pause', () => mState());aud.addEventListener('play', () => mState());aud.addEventListener('seeked', () => calcKey());let mState = () => aud.paused ? (lrc.style.setProperty('--state', 'paused')) : (lrc.style.setProperty('--state', 'running'));let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = data.lrcAr;lrc.dataset.lrc = data.lrcAr.replace(/<br>/, '\n');lrc.style.setProperty('--motion', name);lrc.style.setProperty('--tt', time + 's');lrc.style.setProperty('--state', 'running');mKey += 1;mFlag = !mFlag;};let calcKey = () => {for (j = 0; j < data.lrcAr.length; j++) {if (aud.currentTime <= data.lrcAr) {mKey = j - 1;break;}}if (mKey < 0) mKey = 0;if (mKey > data.lrcAr.length - 1) mKey = data.lrcAr.length - 1;let time = data.lrcAr - (aud.currentTime - data.lrcAr);showLrc(time);};let toMin = (val) => {if (!val) return '00:00';val = Math.floor(val);let min = parseInt(val / 60), sec = parseFloat(val % 60);if (min < 10) min = '0' + min;if (sec < 10) sec = '0' + sec;return min + ':' + sec;};drawAll();};mkPlayer.HCPlayer = playCode;})(this);

let lrcAr = [
['0.00', ' 曲名:梦之大',9.50],
['10.00', ' 演唱: 冰心',9.50],
['20.00', ' 编辑 : 三月的阳光',6.45],
['26.79', '那时候多简单啊',2.94],
['29.88', '三五人一片天下',3.05],
['33.09', '在村头吹牛拍马',3.05],
['36.30', '一晃多少年啦',2.94],
['39.39', '现在的人多复杂',3.02],
['42.57', '忙忙碌碌没钱花',3.05],
['45.78', '感情感人又虚假',2.96],
['48.90', '没人说知心话',2.99],
['52.05', '那时的天之大',2.94],
['55.14', '纸飞机都不怕',3.11],
['58.41', '那时的梦之大',2.88],
['61.44', '行李都装不下',3.05],
['64.65', '现在的城市啊',2.99],
['67.80', '四海都不是家',2.91],
['70.86', '这世界的风之大',3.13],
['74.16', '把人都吹散啦',26.99],
['102.57', '那时候多简单啊',2.96],
['105.69', '三五人一片天下',3.02],
['108.87', '在村头吹牛拍马',3.02],
['112.05', '一晃多少年啦',2.94],
['115.14', '现在的人多复杂',3.05],
['118.35', '忙忙碌碌没钱花',3.05],
['121.56', '感情感人又虚假',2.99],
['124.71', '没人说知心话',2.96],
['127.83', '那时的天之大',2.96],
['130.95', '纸飞机都不怕',3.05],
['134.16', '那时的梦之大',2.91],
['137.22', '行李都装不下',3.05],
['140.43', '现在的城市啊',3.02],
['143.61', '四海都不是家',2.88],
['146.64', '这世界的风之大',3.14],
['149.94', '把人都吹散啦',3.02],
['153.12', '那时的天之大',2.94],
['156.21', '纸飞机都不怕',2.94],
['159.30', '那时的梦之大',2.91],
['162.36', '行李都装不下',3.16],
['165.69', '现在的城市啊',3.02],
['168.87', '四海都不是家',2.88],
['171.90', '这世界的风之大',3.11],
['175.17', '把人都吹散啦',4.5]
];
       HCPlayer({
      lrcAr: lrcAr,
        lrc_css: '--bg: linear-gradient(hsla(120,50%,95%,.45),hsla(120,100%,50%,.65); color: hsla(120,50%,95%, .7);top:20px;',
        player_css: '--color1: green; --color2: lightgreen;--ww: 800px; --hh: 90px; bottom: 20px; ',
});
})();
</script>


顾-念 发表于 2023-7-23 20:45

嗓音磁性,唱的很稳。点赞!

红影 发表于 2023-7-23 21:56

冰心嫂子的翻唱很好听,帖子制作也漂亮,好像没居中呢。
不管了,这里是翻唱版,歌曲好听才是真的{:4_199:}

樵歌 发表于 2023-7-24 07:03

这嗓子,没的说,非常动听的那种!{:4_204:}

冰心 发表于 2023-7-26 23:48

顾-念 发表于 2023-7-23 20:45
嗓音磁性,唱的很稳。点赞!

问好哈感谢临帖

冰心 发表于 2023-7-26 23:49

红影 发表于 2023-7-23 21:56
冰心嫂子的翻唱很好听,帖子制作也漂亮,好像没居中呢。
不管了,这里是翻唱版,歌曲好听才是真的{:4_199: ...

哈主要是代码 我也调不好哈

冰心 发表于 2023-7-26 23:49

樵歌 发表于 2023-7-24 07:03
这嗓子,没的说,非常动听的那种!

这歌词蛮贴现状哈

红影 发表于 2023-7-27 10:59

冰心 发表于 2023-7-26 23:49
哈主要是代码 我也调不好哈

问问阳光哥哥,他知道的啊{:4_173:}
页: [1]
查看完整版本: 【梦之大】