醉美水芙蓉 发表于 2022-12-13 20:30

学习31号响应式条状频谱

本帖最后由 醉美水芙蓉 于 2022-12-13 20:31 编辑 <br /><br /> <style>
#papa { margin: 0 0 0 calc(50% - 621px); width: 1024px; height: 683px; background: lightblue url('https://pic.imgdb.cn/item/6398623db1fccdcd36764fe9.jpg'); box-shadow: 3px 3px 20px #000; position: relative; display: grid; place-items: center; z-index: 1; }
#dt1{ position: absolute; width: 300px; height: 200px; top: -22px; left: -10px; }
#dt2{ position: absolute; width: 250px; height: 200px; top: 480px; left: 780px; }
</style>

<div id="papa">
   
<img id="dt1" src="https://pan.365.tf/uploads/lxx/20221112/6niao.gif" alt="" />
      <img id="dt2" src="https://pan.365.tf/uploads/lxx/20221112/hc.gif" alt="" />
</div>
<audio id="aud" src="https://www.qqmc.com/up/kwlink.php?id=252259032.mp3" loop autoplay></audio>
<script>
(function() {
(function(mkPlayer) {let defaults = {lrcAr: [],ypData: new Array(500).fill(0).map((v, k) => Math.floor(Math.random() * 200) + 10),pinpu: {size: 4, gap: 2,},player_css: '',lrc_css: '',playerCode: `<style>#mplayer{--ww:300px;--hh:140px; --color1:darkgreen; --color2:snow);position:absolute; bottom: 1px; width:var(--ww); height:var(--hh); display:flex; justify-content:center; align-items:flex-end; cursor:pointer;} .mLine{position:relative; margin:0 1px 0 1px; width:4px; height:8px; background:linear-gradient(to top,var(--color1),var(--color2)); transition:.35s; opacity: .95;} #lrc{--motion:cover2; --tt:2s; --state:paused; --bg:linear-gradient(180deg, hsla(60, 50%, 50%, .45), hsla(0, 100%, 50%, .75)); position:absolute; top:20px; font:bold 2.4em sans-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%;}}</style><div id="mplayer"></div><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;
mplayer.onclick = () => aud.paused ? aud.play() : aud.pause();aud.loop = false;
let ppsize = data.pinpu.size || 4, gap = data.pinpu.gap || 2;let total = Math.ceil(mplayer.offsetWidth / (ppsize + gap));let mKey = 0,ppnum = 0, mFlag = true;for (j = 0; j < total; j++) {let el = document.createElement('span');el.className = 'mLine';el.style.width = ppsize + 'px';el.style.marginLeft = el.style.marginRight = gap/2 + 'px';mplayer.appendChild(el);}let lines = document.querySelectorAll('.mLine');let max = Math.max.apply(null, data.ypData);let divide = max / mplayer.offsetHeight, coe = 20 / total / 2, plus;aud.addEventListener('pause', () => mState());aud.addEventListener('playing', () => { mState(); update(); });aud.addEventListener('ended', () => { mKey = 0; ppnum = 0; aud.play(); });aud.addEventListener('timeupdate', () => {ppnum++;if (ppnum >= data.ypData.length) ppnum = 0;update();for (j = 0; j < data.lrcAr.length; j++) {if (aud.currentTime >= data.lrcAr) {cKey = j;if (mKey === j) showLrc(data.lrcAr);else continue;}}});let update = () => lines.forEach((item, key) => {plus = (key < total / 2 ? key : total - key) * coe * 10;item.style.setProperty('height', Math.random() * (data.ypData - 30) / divide + plus + 'px');});let mState = () => aud.paused ? lrc.style.setProperty('--state', 'paused') : 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;};};mkPlayer.HCPlayer = playCode;})(this);
      
        let lrcAr = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];

    ypData = ;
      HCPlayer({
                lrcAr: lrcAr,
                ypData: ypData,
                lrc_css: '',
                       player_css: '--color1:hsl(67, 100%, 50%); --color2: hsla(0,0%,100%,0.15); --ww: 60%; align-items: center; bottom: 1px;',
                     });
})();
</script>

闲言不语 发表于 2022-12-13 20:39

https://pic.imgdb.cn/item/5fddc7c33ffa7d37b383b033.gif

闲言不语 发表于 2022-12-13 20:40

漂亮的背景图,养颜的动画!{:4_199:}

醉美水芙蓉 发表于 2022-12-13 20:46

闲言不语 发表于 2022-12-13 20:40
漂亮的背景图,养颜的动画!

不语老师晚上好!谢谢老师点评支持!

红影 发表于 2022-12-13 22:57

漂亮的制作,那美女手指的方向正是仙鹤的方向呢。欣赏水芙蓉好帖{:4_187:}

醉美水芙蓉 发表于 2022-12-13 23:23

红影 发表于 2022-12-13 22:57
漂亮的制作,那美女手指的方向正是仙鹤的方向呢。欣赏水芙蓉好帖

谢谢红影美女光临支持!

红影 发表于 2022-12-14 12:41

醉美水芙蓉 发表于 2022-12-13 23:23
谢谢红影美女光临支持!

不客气啊,问好水芙蓉美女,中午好{:4_187:}

小辣椒 发表于 2022-12-14 19:58

欣赏水芙蓉的精美制作{:4_199:}

醉美水芙蓉 发表于 2022-12-14 20:52

小辣椒 发表于 2022-12-14 19:58
欣赏水芙蓉的精美制作

谢谢小辣椒鼓励!

小辣椒 发表于 2022-12-14 21:39

醉美水芙蓉 发表于 2022-12-14 20:52
谢谢小辣椒鼓励!

不用客气啊,做的很漂亮的

梦缘 发表于 2022-12-16 15:47

漂亮的频谱,感谢老师的分享!{:4_204:}
页: [1]
查看完整版本: 学习31号响应式条状频谱