醉美水芙蓉 发表于 2023-9-11 21:01:52

神奇九寨更迷人 - 容中尔甲

<style>
#papa { margin: 100px 0 0 calc(50% - 493px); width: 1024px; height: 640px; background: gray url('https://img-baofun.zhhainiao.com/pcwallpaper_ugc/scene/d4845b4ea6774f7782175e574618233f_preview.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; display: grid; place-items: center; z-index: 1; }
#papa::before { position: absolute; content: url('https://638183.freep.cn/638183/t22/gif/bird.gif'); top: 0; }
#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; }
</style>
<div id="papa"><span id="btnMsg">全屏观赏</span></div>
       

</div>
<audio id="aud" src="https://www.qqmc.com/up/kwlink.php?id=204866996&.mp3"autoplay loop></audio>

<script>
(function() {
      
       (function(mkPlayer) {let defaults = {lrcAr: [],lrc_css: 'top: 15px; left: 50%; transform: translate(-50%)',player_css: 'bottom: 15px; left: 50%; transform: translate(-50%)',playerCode: `<style>#mplayer { --ww: 360px; --hh: 120px; --bg: linear-gradient(to top,lightgreen,green,lightgreen); --state: paused; --zx: 0.6; margin: auto; position: absolute; width: var(--ww); height: var(--hh); display: flex; justify-content: center; align-items: flex-end; cursor: pointer; z-indez: 901; }.mLine { position: relative; margin: 0 1px 0 1px; width: 4px; height: 10px; background: var(--bg); transition: height .45s; }.mLine::before, .mLine::after { position: absolute; content: ''; width: 100%; height: 4px; background: var(--ballcolor); top: 0; border-radius: 50%; transform: scale(1.5); animation: up .75s infinite; animation-play-state: var(--state); }#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: -15px;} }</style><div id="lrc" data-lrc="HCPlayer">HCPlayer</div><div id="mplayer" title="播放/暂停"></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;let mKey = 0, mFlag = true;let getCssVal = (e,v) => getComputedStyle(e).getPropertyValue(v);let total = Math.ceil(mplayer.offsetWidth / 6), zx = getCssVal(mplayer,'--zx').replace(/[^\d\.]/ig,'') || 0.25;if(zx > 4) zx = 4;let mid = total % 2 === 0 ? total / 2 - 1 : Math.floor(total / 2);for(j=0; j<total; j++) {let k = j <= mid ? (mid - j) * 2 : (j - mid) * 2 - 1;let el = document.createElement('span');el.className = 'mLine';el.style.cssText = `bottom: ${k*zx}px;background: linear-gradient(#${Math.random().toString(16).substr(-6)},#${Math.random().toString(16).substr(-6)});--ballcolor: linear-gradient(135deg,#${Math.random().toString(16).substr(-6)},#${Math.random().toString(16).substr(-6)});`;mplayer.appendChild(el);}let lines = document.querySelectorAll('.mLine');function update() {lines.forEach((item,key) => item.style.height = Math.floor(Math.random() * (mplayer.offsetHeight - 20))+'px');}aud.addEventListener('timeupdate', () => {update();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());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);};mplayer.onclick = () => aud.paused ? aud.play() : aud.pause();};mkPlayer.HCPlayer = playCode;})(this);
      let lrcAr = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];
      HCPlayer({
               lrcAr: lrcAr,
                lrc_css: 'left: 25px; top: 15px; --bg: linear-gradient(180deg,hsla(120,100%,50%,.35),hsla(120,50%, 35%,.65));',
                player_css: '--ww:400px; --hh: 100px; left: 100px; bottom: 10px;',
      });

      let fs = false, timerId;
      btnMsg.style.opacity = '0';
      btnMsg.onclick = () => fs ? document.exitFullscreen() : papa.requestFullscreen();
      papa.onmousemove = () => {
                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 = '全屏观赏';
                }
      });
})();
</script>

肖浅 发表于 2023-9-12 22:40:21

这个作品漂亮!!!!

肖浅 发表于 2023-9-16 09:19:02

这个作品漂亮!!!!

醉美水芙蓉 发表于 2023-9-16 09:29:59

肖浅 发表于 2023-9-16 09:19
这个作品漂亮!!!!

谢谢朋友欣赏支持!

夏艳妍 发表于 2023-9-20 11:01:00

这个作品漂亮!!!!

醉美水芙蓉 发表于 2023-9-20 11:57:03

夏艳妍 发表于 2023-9-20 11:01
这个作品漂亮!!!!

谢谢朋友支持!

翁奕童苑 发表于 2023-10-15 16:08:35

这个作品漂亮!!!!

醉美水芙蓉 发表于 2023-10-15 16:09:17

翁奕童苑 发表于 2023-10-15 16:08
这个作品漂亮!!!!

谢谢朋友欣赏支持!
页: [1]
查看完整版本: 神奇九寨更迷人 - 容中尔甲