套个玩玩
<style>#papa { margin: 130px 0 0 calc(50% - 781px); display: grid; place-items: center; width: 1400px; height: 750px;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://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/60eb211314282287b8d4202bfa0c14f5.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://365.tf/disk/tf/1678237488.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 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.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>
@小辣椒 进来看看 liumang 发表于 2024-8-2 14:41
@小辣椒 进来看看
来了来了:lol:lol 抽空玩玩,会更加健康的{:6_206:}{:6_206:} 欣赏老师的精美音画!
老谟深虑 发表于 2024-8-4 19:01
欣赏老师的精美音画!
谢谢支持{:5_152:}{:5_152:}{:5_152:} 小辣椒 发表于 2024-8-2 23:39
抽空玩玩,会更加健康的
以后就套用你的{:5_140:} liumang 发表于 2024-8-4 23:49
以后就套用你的
可以啊,尽管玩{:5_140:} 小辣椒 发表于 2024-8-9 20:54
可以啊,尽管玩
好的,好的{:6_206:}
页:
[1]