撒哈拉的雨 发表于 2023-3-14 13:33

心上的罗加


<style>
#papa { margin: 120px 0 0 calc(50% - 720px); display: grid; place-items: center; width: 1280px; height: 756px;box-shadow: 8px 4px 20px hsla(0,0%,0%,.65); user-select: none; overflow: hidden; position: relative; z-index: 1; animation: flash 10s infinite alternate; }
#papa::before { position: absolute; content: ''; width: 100%; height: 100%; background: gray url('https://pan.doliy.cn/filestores/2023/03/13//927155afffd639713be8103a7ae26436.jpg') no-repeat center/cover; transition: .8s; }
#papa:hover::before { transform: scale(1.1); }
@keyframes flash { from {filter: saturate(0); } to {filter: saturate(180%); } }
</style>

<div id="papa"></div>
<audio id="aud" src="https://pan.doliy.cn/filestores/2023/03/13//0cbd9f444a74dc112055bd7ae4f3dc3b.mp3" loop autoplay></audio>

<script >
(function(mkPlayer) {let defaults = {lrcAr: [],lrc_css: 'top: 10px; left: 50%; transform: translateX(-50%);',player_css: 'bottom: 20px; left: 50%; transform: translateX(-50%);',btn_size: '40px',playerCode: `<style>#mplayer {position: absolute;display: grid;grid-template-areas: 'cur btnplay dur''prog prog prog';gap: 2px 6px;place-items: end center;color: var(--color);font: normal 16px sans-serif;z-index: 999;--ww: 260px;--color: hsl(0, 100%, 100%);}#btnplay {grid-area: btnplay;--state: paused;width: 40px;height: 40px;cursor: pointer;display: grid;place-items: center;animation: rot linear 3s infinite;position: relative;animation: rot 3s linear infinite;animation-play-state: var(--state);}#btnplay > span {position: absolute;width: 10px;height: 10px;border-radius: 50%;background: linear-gradient(tan,red);}#prog {grid-area: prog;width: var(--ww);height: 20px;opacity: .95;cursor: pointer;}#cur { grid-area: cur; color: var(--color); }#dur { grid-area: dur; color: var(--color); }#lrc {--motion: cover2;--tt: 2s;--state: paused;--bg: linear-gradient(180deg,hsla(60,100%,50%,.45),hsla(200,50%,50%,.75));position: absolute;left: 20px;top: 10px;font: bold 2.4em sans-serif;color: hsl(0, 10%, 90%);white-space: pre;-webkit-background-clip: text;filter: drop-shadow(1px 1px 2px hsla(0, 0%, 0%, .95));}#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 rot { to { transform: rotate(1turn); } }</style><div id="lrc" data-lrc="HCPlayer">HCPlayer</div><div id="mplayer"><div id="cur">00:00</div><div id="btnplay"><span></span></div><div id="dur">00:00</div><meter id="prog" max="100" low="25" high="75" optimum="85" value="0"></meter></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;btnplay.style.width = btnplay.style.height = data.btn_size || '40px';let mKey = 0, mFlag = true;btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();prog.onclick = (e) => aud.currentTime = aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;aud.addEventListener('timeupdate', () => {prog.value = aud.currentTime / aud.duration * 100;cur.innerText = toMin(aud.currentTime);dur.innerText = toMin(aud.duration);for (j = 0; j < data.lrcAr.length; j++) {if (aud.currentTime >= data.lrcAr) {cKey = j;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'),btnplay.style.setProperty('--state', 'paused')) : (lrc.style.setProperty('--state','running'),btnplay.style.setProperty('--state', 'running'));let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = lrcAr;lrc.dataset.lrc = 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;};(function mkSpan() {[...Array(10).keys()].forEach((ele, key) => {ele = document.createElement('span');ele.style.cssText += `background: linear-gradient(135deg, #${Math.random().toString(16).substr(-6)}, #${Math.random().toString(16).substr(-6)});transform: rotate(${key*36}deg) translate(18px)`;btnplay.appendChild(ele);});})();};mkPlayer.HCPlayer = playCode;})(this);

let lrcAr = [
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,

];

HCPlayer({
      lrcAr: lrcAr,
       lrc_css: 'top: 500px; left: 420px; --bg: #fcff00;',
       player_css: 'bottom: 20px; left: 900px; --color: #ccc; --ww: 180px;',
});

</script>
<br><br>

撒哈拉的雨 发表于 2023-3-14 13:35

@宁静

鼠标滑过画面看看

撒哈拉的雨 发表于 2023-3-14 13:43

这歌有点长的{:9007:}

宁静 发表于 2023-3-14 18:48

撒哈拉的雨 发表于 2023-3-14 13:35
@宁静

鼠标滑过画面看看

不好意思,送花手机还没有弄好,出去了,补回来{:9007:}

宁静 发表于 2023-3-14 18:51

这个界面效果很美,还会变色{:9022:}

宁静 发表于 2023-3-14 18:52

歌曲也是好听,完美{:10_402:}

宁静 发表于 2023-3-14 18:53

撒哈拉的雨 发表于 2023-3-14 13:43
这歌有点长的

8分多钟,是有点长的

墨羽 发表于 2023-3-14 18:54

草原上的歌可以治疗胸闷抑郁,哈哈!

宁静 发表于 2023-3-14 19:02

手机欣赏很完美,我会学习做一次

宁静 发表于 2023-3-14 19:06

撒哈拉的雨 发表于 2023-3-14 13:35
@宁静

鼠标滑过画面看看

手机划过界面效果只有点击播放器按钮的时候出现特效。电脑欣赏应该会更加完美
页: [1] 2
查看完整版本: 心上的罗加