《心上的罗加》阿鲁阿卓
<style>#papa { margin: 70px 0 0 calc(50% - 643px); display: grid; place-items: center; width: 1164px; height: 640px;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('http://tuku.link/imgs/2023/03/4f0c15a64e0e779c.jpg') no-repeat center/cover; transition: .7s; }
#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://www.joy127.com/url/101396.mp3" loop autoplay></audio>
<script >
(function() {
(function(mkPlayer) {let defaults = {lrcAr: [],lrc_css: 'bottom: 20px; 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 2s 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.0em 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><progress id="prog" max="100"></progress></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'),mplayer1.style.setProperty('--state', 'paused')) : (lrc.style.setProperty('--state','running'),btnplay.style.setProperty('--state', 'running'),mplayer1.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: 560px; left: 560px; --bg: #fcff00;',
player_css: 'bottom: 40px; left: 80px; --color: #ccc; --ww: 180px;',
});
})();
</script>
<p> </p>
<p> </p>
<p> </p>
页:
[1]