绒花 -- 演唱:廖昌永
本帖最后由 宁静 于 2023-2-22 13:45 编辑 <br /><br /><style>#papa { margin: 120px 0 0 calc(50% - 775px); display: grid; place-items: center; width: 1400px; height: 774px; background: gray url('https://pan.365.tf/uploads/lxx/20230222/rhua.gif') no-repeat center/cover; overflow: hidden; user-select: none; box-shadow: 6px 3px 20px #000; position: relative; perspective: 3000px; z-index: 1; }
</style>
<div id="papa"></div>
<audio id="aud" src="https://pan.365.tf/uploads/lxx/20230222/rhua.mp3" loop autoplay></audio>
<script >
(function() {
(function(mkPlayer) {let defaults = {lrcAr: [,],ttAr: ['花潮','论坛','LRC','在线'],lrc_css: 'bottom: 80px; left: 20%; transform: translateX(-50%);',player_css: 'bottom: 20px; left: calc(50% - 60px);', total: 20,playerCode: `<style>#mplayer {--bg: silver;position: absolute;height: 200px;width: 160px;color: #fff;transform-style: preserve-3d;animation: spin 10s linear infinite;transform-origin: 58px 100px 58px;cursor: pointer;}#mplayer > div {position: absolute;border-style: solid;border-width: 100px 0 100px 173px;transform-origin: 0 0;border-color: transparent transparent transparent var(--bg);}#mplayer > div:after {position: absolute;content: attr(data-txt);text-box: 1px 1px 2px #000;left: -130px;top: -20px;text-align: center;font: bold 2em sans-serif;}#mplayer > div:nth-of-type(1){transform: rotateY(-19.5deg) rotateX(180deg) translateY(-200px);opacity: .6;}#mplayer > div:nth-of-type(2) {transform: rotateY(90deg) rotateZ(60deg) rotateX(180deg) translateY(-200px);opacity: .7;}#mplayer > div:nth-of-type(3) {transform: rotateX(60deg) rotateY(19.5deg);opacity: .8;}#mplayer > div:nth-of-type(4) {transform: rotateX(-60deg) rotateY(19.5deg) translateX(-58px) translateY(-100px) translateZ(163px);opacity: .9;}#btnMsg { position: absolute; color: snow; background: #d12f02; opacity: 0; border: 2px solid snow; border-radius: 8px; padding: 4px; transition: all .75s; cursor: pointer; 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 spin {from { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }to { transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg); }}@keyframes cover1 { from { width: 0; }to { width: 100%; } }@keyframes cover2 { from { width: 0; } to { width: 100%; } }</style><div id="lrc" data-lrc="HCPlayer">HCPlayer</div><div id="mplayer"><div data-txt="花潮"></div><div data-txt="花潮"></div><div data-txt="花潮"></div><div data-txt="花潮"></div></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, tnow = Date.now(), timerId;;data.ttAr.forEach( (item,key) => {let divs = mplayer.children;divs.setAttribute('data-txt',item);});mplayer.onclick = () => 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"', 3000);};document.addEventListener("fullscreenchange", () => {if (document.fullscreenElement !== null) {fs = true;btnMsg.innerText = '退出全屏';} else {fs = false;btnMsg.innerText = '全屏观赏';}});aud.addEventListener('pause', () => mState());aud.addEventListener('play', () => mState());aud.addEventListener('seeked', () => calcKey());let mState = () => aud.paused ? (lrc.style.setProperty('--state','paused'), mplayer.style.animationPlayState='paused') : (lrc.style.setProperty('--state','running'), mplayer.style.animationPlayState='running');aud.addEventListener('timeupdate', () => {for (j = 0; j < data.lrcAr.length; j++) {if (aud.currentTime >= data.lrcAr) {if (mKey === j) showLrc(data.lrcAr);else continue;}}});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);
HCPlayer({
lrcAr: [,,,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,],
ttAr: ['播放','停止','播放','停止'],
player_css: '--bg: tan; bottom: 140px; left: 45%; color: Tomato;',
});
})();
</script>
<br><br> 老歌好听,自娱自乐 宁静 发表于 2023-2-10 21:17
老歌好听,自娱自乐
老歌好听{:9022:}
现在某人已经是中央音乐学院的院长了 声线确实好,无论低音高音,轻松驾驭 怎么想到做这首歌了 2个标题做的好 三角形的播放器,也是第一次看见 整体效果不错的 老图新做,也是不错的,可以轻松一点,反正玩的就是播放器