山里人 发表于 2022-12-30 12:07

世界由我造(纯音乐)

本帖最后由 山里人 于 2022-12-30 12:25 编辑 <br /><br /> <div class="pct"><style type="text/css">.pcb{margin-right:0}</style><div class="pcb">

<div class="t_fsz">
<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_1806850">

<style>


#papa { margin: 0 0 0 calc(50% - 593px); width: 1020px; height: 640px; background: darkgray url('https://ln2018.oss-cn-hangzhou.aliyuncs.com/tp/q.jpg') no-repeat center/cover; box-shadow: 4px 8px 16px #000; display: grid; place-items: center; perspective: 1000px;position: relative; opacity: .95; z-index: 1; }
#tit{position: absolute; left:120px; top: -30px;background-image:url('https://ln2018.oss-cn-hangzhou.aliyuncs.com/tp/bk/bk_7.gif'); background-size:cover; width:800px; height:200px; font: bold 2.5em sans-serif; text-align:center; line-height:200px; color:transparent; -webkit-background-clip:text; border:0px #ff0 solid; }
#papa::before { position: absolute;content: ''; bottom: 60px; width: 420px; height: 140px; background: url('https://ln2018.oss-cn-hangzhou.aliyuncs.com/h5/haha/qianqian.gif') no-repeat center/cover; border-radius: 100%; transform-style: preserve-3d; transform: rotateY(180deg) rotateZ(-0deg); pointer-events: none; box-shadow: 2px 4px 4px #222; }

</style>

<div id="papa"></div>
<div id="tit">世界由我造-纯音乐</div>
<audio id="aud" src="http://chuangshicdn.data.mvbox.cn/music/bz/22/12/29/22122900313777320738.mp3" autoplay loop></audio>

<script >
(function() {
        (function(mkPlayer) {let defaults = {lrcAr: [ ],lrc_css: 'top: 15px; left: 50%; transform: translate(-50%)',player_css: 'bottom: 5px; left: 50%; transform: translate(-50%)',angle: -90,playerCode: `<style>#mplayer {--ww: 300px;--hh:100px;--state: paused;position: absolute;width: var(--ww);height: var(--hh);transform-style: preserve-3d;cursor: pointer;z-index: 899;}#mplayer::before { position: absolute; content: ''; left: -20px; right: -20px; top: 0; bottom: -35px; }.mline {position: absolute;width: 6px;height: 10px;bottom: 0;left: calc(50% - 4px);border-radius: 10px;transition: all .35s;opacity: .95;}.mline::before {position: absolute;content: '';width: 10px;height: 2px;left: calc(50% - 5px);background: var(--psecolor);border-radius: 50%;transition: all var(--ts);animation: up 1s infinite;animation-play-state: var(--state);}#btnMsg {position: absolute;color: snow;background: green;opacity: 0;border: 2px solid snow;border-radius: 8px;padding: 4px;transition: all .75s;cursor: pointer;z-index: 1001;}#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%; } }@keyframes up { to { top: -20px; } }</style><div id="lrc" data-lrc="HCPlayer">HCPlayer</div><div id="mplayer"></div><span id="btnMsg">全屏观赏</span>`,};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, fs = false, timerId;let total = Math.floor(mplayer.offsetWidth / 8), mRad = Math.floor(mplayer.offsetWidth /1.8), tnow = Date.now();mplayer.onclick = (e) => aud.paused ? aud.play() : aud.pause();btnMsg.onclick = () => fs ? document.exitFullscreen() : papa.requestFullscreen();papa.onmousemove = (e) => {clearTimeout(timerId);btnMsg.style.opacity = '.95';timerId = setTimeout('btnMsg.style.opacity = "0"', 6000);};for (j = 0; j < total; j++) {let ele = document.createElement('span');ele.className = 'mline';ele.style.cssText += `background: linear-gradient(to bottom, #${Math.random().toString(16).substr(-6)}, #${Math.random().toString(16).substr(-6)});transform: rotateY(${j*-180/total + data.angle}deg) translateZ(${mRad}px);--psecolor: linear-gradient(135deg, #${Math.random().toString(16).substr(-6)}, #${Math.random().toString(16).substr(-6)});--ts: ${Math.random()}s;`;mplayer.appendChild(ele);}let lines = document.querySelectorAll('.mline');let update = () => {if (Date.now() - tnow > 65) {lines.forEach((item, key) => {let ph = aud.paused ? 0 : mplayer.offsetHeight;item.style.height = Math.random() * ph + 'px';});tnow = Date.now();}requestAnimationFrame(update);};update();aud.addEventListener('timeupdate', () => {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());document.addEventListener("fullscreenchange", () => {if (document.fullscreenElement !== null) {fs = true;btnMsg.innerText = '退出全屏';} else {fs = false;btnMsg.innerText = '全屏观赏';}});let mState = () => aud.paused ? (lrc.style.setProperty('--state', 'paused'), mplayer.style.setProperty('--state', 'paused')) : (lrc.style.setProperty('--state', 'running'), mplayer.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);};};mkPlayer.HCPlayer = playCode;})(this);
        let lrcAr = [
   ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
    ];
        HCPlayer({
                lrcAr: lrcAr,
                player_css: '--ww: 300px; --hh:100px; bottom: 90px;',
                lrc_css: '--bg: linear-gradient(180deg,hsla(255,100%,50%,.95),hsla(0,100%,50%,.99)); color: lightblue; top: 580px;',
        });
})();
</script>
</td></tr></table>

马黑黑 发表于 2022-12-30 12:18

配色很漂亮,好帖!

帖子水平方向不够居中

山里人 发表于 2022-12-30 12:22

马黑黑 发表于 2022-12-30 12:18
配色很漂亮,好帖!

帖子水平方向不够居中

用老师的作品练习的,不熟悉代码制作,感谢老师分享代码

马黑黑 发表于 2022-12-30 12:25

山里人 发表于 2022-12-30 12:22
用老师的作品练习的,不熟悉代码制作,感谢老师分享代码

你加工的很好,效果杠杠的

红影 发表于 2022-12-30 19:21

不知道是不是我电脑问题,标题文字好像跑到最上面去了。{:4_173:}

红影 发表于 2022-12-30 19:22

漂亮的半圆播放器,欣赏山里人好帖{:4_187:}
页: [1]
查看完整版本: 世界由我造(纯音乐)