雨中悄然 发表于 2023-2-12 23:23

【回赠清舟】女人花(学习黑师枕边童话播放效果)

<style>
#papa {
      margin: 100px 0 0 calc(50% - 593px);
      display: grid;
      place-items: center;
      width: 1024px;
      height: 640px;
      background: lightblue url('https://pic.imgdb.cn/item/63e901074757feff33ae7aa1.jpg') no-repeat center/cover;
      box-shadow: 6px 3px 20px #000;
      user-select: none;
      position: relative;
      z-index: 1;
}
#tit {
      position: absolute;
      width: fit-content;
      height: fit-content;
      right: 60px;
      bottom: 150px;
      color: snow;
      font: bold 36px/40px 'FangSong',serif;
}
.mysp {
      position: relative;
      display: block;
}

@keyframes move {
      0% { right: 10px; transform: rotate(0); color: olive; }
      50% { right: 100px; transform: rotate(360deg); color: red; }
      100% { right: 10px; transform: rotate(720deg); color: green; }
}
</style>

<div id="papa">
      <div id="tit"></div>
</div>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=276130.mp3" loop autoplay></audio>

<script >
(function() {
      (function(mkPlayer) {let defaults = {lrcAr: [],lrc_css: 'top: 10px; left: 15px;',player_css: '',playerCode: `<style>#mplayer {position: absolute;left: left: calc(50% - 60px);bottom: 10px;--track: hsla(100,30%,80%,.65);--prog: hsla(100,60%,50%,.55);--color: #e9f1f6;}#btnwrap { display: block; fill: var(--color); opacity: .85; cursor: pointer; }#btnwrap:hover { opacity: 1; }#track { fill: none; stroke: var(--track); }#prog { fill: none; stroke: var(--prog); }#tmsg { fill: var(--color); stroke: none; font: bold 1em sans-serif; }#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%; } }</style><svg id="mplayer" width="120" height="120"><g id="circle_wrap" transform="rotate(-90, 60, 60)" style="cursor: pointer;"><circle id="track" cx="60" cy="60" r="50" stroke-width="10" /><circle id="prog" cx="60" cy="60" r="50" stroke-width="10" /></g><g id="btnwrap"><path id="btnplay" d="M 50 50,50 70,70, 60 z"></path><path id="btnpause" d="M 52 50,52 70,57 70,57 50,52 50 z M 60 50,60 70,65 70,65 50,60 50 z" style="display: none;"></path><path d="M 57 50,60 50,60 70,57 70 z" fill="transparent" /></g><path id="curPath" d="M 20 70 Q 60 0 100 70" fill="none" stroke="none" /><path id="durPath" d="M 20 55 Q 60 110 100 55" fill="none" stroke="none" /><g id="tmsg"><text x="34" y="0"><textPath id="curMsg" xlink:href="#curPath" dominant-baseline="text-after-edge">00:00</textPath></text><text x="29" y="0"><textPath id="durMsg" xlink:href="#durPath" dominant-baseline="text-before-edge">00:00</textPath></text></g></svg><div id="lrc" data-lrc="HCPlayer">HCPlayer</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, cc = { x: 1 * track.getAttribute('cx'), y: 1 * track.getAttribute('cy'), len: track.getTotalLength(), };prog.style.strokeDasharray = prog.style.strokeDashoffset = cc.len;btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();circle_wrap.onclick = (e) => {let deg = Math.atan2(e.offsetY - cc.y, e.offsetX - cc.x) * 180 / Math.PI;deg += (e.offsetX < cc.x && e.offsetY < cc.y) ? 450 : 90;aud.currentTime = aud.duration * deg / 360;};aud.addEventListener('timeupdate', () => {prog.style.strokeDashoffset = cc.len - cc.len * aud.currentTime / aud.duration;curMsg.textContent = toMin(aud.currentTime);durMsg.textContent = toMin(aud.duration);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 ? (btnplay.style.display = 'block', btnpause.style.display = 'none', lrc.style.setProperty('--state', 'paused')) : (btnplay.style.display = 'none', btnpause.style.display = 'block', lrc.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);};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;};};mkPlayer.HCPlayer = playCode;})(this);
      (function(mkFS) {let setFullScreen = (user_set) => {let pa = user_set.pa;if(typeof(pa) !== 'object') return false;if(!user_set.set) user_set.set = 'color: snow; background: black; border: 2px solid snow; left: 40px; bottom: 40px;';btnMsg = document.createElement('span');btnMsg.style.cssText = `position: absolute; border-radius: 8px; padding: 4px; cursor: pointer; z-index:998; ${user_set.set}`;btnMsg.innerText = '全屏观赏';btnMsg.style.display = 'none';pa.appendChild(btnMsg);let timerId, fs = false;btnMsg.onclick = () => fs ? document.exitFullscreen() : pa.requestFullscreen();pa.addEventListener('mousemove', (e) => {clearTimeout(timerId);btnMsg.style.display = 'block';timerId = setTimeout('btnMsg.style.display = "none"', 3000);});document.addEventListener('fullscreenchange', () => {if (document.fullscreenElement !== null) {fs = true;btnMsg.innerText = '退出全屏';} else {fs = false;btnMsg.innerText = '全屏观赏';}});};mkFS.FS = setFullScreen;})(this);

      let lrcAr = [
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      ,
      
];

      HCPlayer({
                lrcAr: lrcAr,
                player_css: 'bottom: 10px; right: 10px;',
                lrc_css: 'left: 20px; bottom: 10px;',
      });

      FS({
                pa: papa,
                set: 'color: snow; background: transparent; border: 2px solid snow;',
      });

      let spans = [],idx = 0, last = null;

      [...'女人花'].forEach((item,key) => {
                let sp = document.createElement('span');
                sp.className = 'mysp';
                sp.innerHTML = item + '<br>';
                spans.push(sp);
                tit.appendChild(sp);
      });

      let mov = () => {
                if(last != null) spans.style.animation = '';
                spans.style.animation = 'move 2s';
                last = idx;
                idx += 1;
                if(idx >= spans.length) idx = 0;
                setTimeout(mov,2000);
      };

      mov();
})();
</script>

雨中悄然 发表于 2023-2-12 23:24

@绿叶清舟

雨中悄然 发表于 2023-2-12 23:24

昨天收到你的贴子,今天回来有点晚,匆忙整了一贴。
歌词个别句子还有些不对,先凑和听,改天有空我再整清楚{:4_173:}

雨中悄然 发表于 2023-2-12 23:26

这首歌记得素当时翻唱过,印象深刻,温柔可人,希望你喜欢{:4_187:}

红影 发表于 2023-2-12 23:30

悄然做帖做到这么晚,又是个播放器效果,做的很完美。悄然真棒{:4_187:}

雨中悄然 发表于 2023-2-12 23:31

红影 发表于 2023-2-12 23:30
悄然做帖做到这么晚,又是个播放器效果,做的很完美。悄然真棒

{:4_170:}回得晚,明天又忙,还是今日事今日毕

马黑黑 发表于 2023-2-12 23:34

好花

庶民 发表于 2023-2-13 05:33

欣赏美好。

红影 发表于 2023-2-13 15:34

雨中悄然 发表于 2023-2-12 23:31
回得晚,明天又忙,还是今日事今日毕

这么拼啊,悄然到底年轻{:4_199:}

海笑 发表于 2023-2-13 15:56

欣赏老师佳作!

雨中悄然 发表于 2023-2-13 17:52

海笑 发表于 2023-2-13 15:56
欣赏老师佳作!

感谢支持临帖

雨中悄然 发表于 2023-2-13 17:53

红影 发表于 2023-2-13 15:34
这么拼啊,悄然到底年轻

{:4_170:}饭局饭局,没拼啥

雨中悄然 发表于 2023-2-13 17:53

庶民 发表于 2023-2-13 05:33
欣赏美好。

感谢支持

雨中悄然 发表于 2023-2-13 17:53

马黑黑 发表于 2023-2-12 23:34
好花

支持好花。黑老师好{:4_187:}

马黑黑 发表于 2023-2-13 19:05

雨中悄然 发表于 2023-2-13 17:53
支持好花。黑老师好

更好的花{:4_170:}

红影 发表于 2023-2-13 22:04

雨中悄然 发表于 2023-2-13 17:53
饭局饭局,没拼啥

饭局肯定也有拼呢,拼酒啊。拼完酒还能做帖子,厉害{:4_189:}

雨中悄然 发表于 2023-2-13 22:12

马黑黑 发表于 2023-2-13 19:05
更好的花

你说的都对,有更好的还有最好的

雨中悄然 发表于 2023-2-13 22:12

红影 发表于 2023-2-13 22:04
饭局肯定也有拼呢,拼酒啊。拼完酒还能做帖子,厉害

{:4_170:}醉着做的?

马黑黑 发表于 2023-2-13 22:36

雨中悄然 发表于 2023-2-13 22:12
你说的都对,有更好的还有最好的

没有最好只有更好

红影 发表于 2023-2-13 23:00

雨中悄然 发表于 2023-2-13 22:12
醉着做的?

更洒脱自在啊,做出的帖子更奔放{:4_189:}
页: [1] 2
查看完整版本: 【回赠清舟】女人花(学习黑师枕边童话播放效果)