楼主: 花简静

花简静贴子代码及说明汇总(翻页有新贴)

[复制链接]
山外有山 山高为峰 版主勋章 樱果相依 闲花落
 楼主| 发表于 2024-6-10 22:38 | 显示全部楼层
HUACHAO PLAYER
点评
回复

使用道具

山外有山 山高为峰 版主勋章 樱果相依 闲花落
 楼主| 发表于 2024-6-10 22:38 | 显示全部楼层
本帖最后由 花简静 于 2024-6-10 22:59 编辑

<style> #tz { margin: 130px 0 30px calc(50% - 931px); width: 1700px; height: 900px; background: url('https://642303.freep.cn/642303/tu/240610ditou003.webp') no-repeat center/cover; box-shadow: 2px 2px 6px gray; overflow: hidden; position: relative; }   #lrc { position: absolute; left: 520px; bottom: 10px; font: bold 26px sans-serif; white-space: nowrap; color:     LimeGreen; text-shadow: 2px 2px 1px black; animation: fly 10s linear infinite alternate var(--state); --ww: 350px;opacity : .5; } #player { position: absolute; left: calc(50% - 140px); bottom: 60px; width: 280px; height:10px; background: linear-gradient(to right, var(--color) var(--prg), transparent 0); border: 1px solid var(--color); border-radius: 6px; display: grid; place-items: center; --color: green; --prg: 0%; --btnSize: 50px;} #player::before, #player::after { position: absolute; content: ''; } #player::before { width: var(--btnSize); height: var(--btnSize); top: calc(var(--btnSize) * -1 - 5px); background: url('https://642303.freep.cn/642303/tu/f8.png') no-repeat center/cover; filter: hue-rotate(80deg);animation: rot 6s linear infinite var(--state);} #player::after { content: attr(data-time); inset: -30px 0 10px 0; text-align: justify; text-align-last: justify; font-size: 14px; color: var(--color); pointer-events: none; } .vid { position: absolute; bottom: 0; width: 100%; height: calc(100% + 80px); object-fit: cover; mix-blend-mode: screen; pointer-events: none;opacity : .5; } @keyframes rot { to { transform: rotate(360deg); } } @keyframes fly { to { left: calc(100% - var(--ww) - 520px); } } </style>   <div id="tz">     <audio id="aud" src="https://music.163.com/song/media/outer/url?id=1978686514.mp3" autoplay loop></audio>     <video class="vid" src="https://img.tukuppt.com/video_show/15653652/00/79/86/60c98c8146068.mp4" autoplay loop muted></video>     <div id="lrc">HUACHAO PLAYER</div>     <div id="player" data-time="00:00 00:00"></div> </div>   <script> var vids = document.querySelectorAll('.vid'); var btnSize = parseInt(window.getComputedStyle(player).getPropertyValue('--btnSize'));   var lrcKey = 0;   var showLrc = () => {     if(lrcKey >= lrcAr.length) return false;     lrc.innerText = lrcAr[lrcKey][1];     lrc.style.setProperty('--ww', lrc.offsetWidth + 'px');     lrcKey ++; };   var mState = () => {     tz.style.setProperty('--state',['running','paused'][+aud.paused]);     if(vids.length > 0) vids.forEach(vid => aud.paused ? vid.pause() : vid.play()); };   var s2m = (s) => (Math.floor(s / 60)).toString().padStart(2, '0') + ':' + (Math.floor(s % 60)).toString().padStart(2, '0');   aud.onplaying = aud.onpause = () => mState();   aud.onseeked = () => {     for(var j = 0; j < lrcAr.length; j ++) {         if(aud.currentTime < lrcAr[j][0]) {             lrcKey = j - 1;             if(lrcKey < 0) lrcKey = 0;             break;         }     } };   aud.ontimeupdate = () => {     player.style.setProperty('--prg', (aud.currentTime / aud.duration * 100 || 0) + '%');     player.dataset.time = s2m(aud.currentTime) + ' ' + s2m(aud.duration);     if(lrcKey <= lrcAr.length - 1 && aud.currentTime >= lrcAr[lrcKey][0]) showLrc(); }   player.onclick = (e) => {     if(e.offsetY > 0) aud.currentTime = aud.duration * e.offsetX / player.offsetWidth;     if(e.offsetY < 0 && e.offsetX > player.offsetWidth / 2 - btnSize / 2 && e.offsetX < player.offsetWidth / 2 + btnSize / 2) aud.paused ? aud.play() : aud.pause(); }   player.onmousemove = (e) => {     if(e.offsetY < 0) {         if(e.offsetX > player.offsetWidth / 2 - btnSize / 2 && e.offsetX < player.offsetWidth / 2 + btnSize / 2) {             player.title = aud.paused ? '播放' : '暂停';             player.style.cursor = 'pointer';         }     }else{         player.title = '调节进度';         player.style.cursor = 'pointer';     } };   var lrcAr= [[0.00, "祁紫檀 - 广袤天地", 10],[18.00, " 词曲 : 祁紫檀 编曲 : 杨若舟", 7.1],[27.15, " 无论如何我会试着理解你", 5.6],[33.48, " 借口形而上与不着边际", 5.2],[40.53, " 窗外下起了雨", 2.5],[43.5, " 我在房间里明媚呼吸", 2.5],[46.86, " 与世界的相处总是奇异", 5.0],[53.91, " 终其一生 寻找自我与世界的角度", 5.6],[60.57, " 终其一生 寻找一种语言描述自己", 5.8],[67.2, " 倾听你 告诉你", 1.7],[68.94, " 同一个词语", 3.4],[73.47, " 每个人眼里不同的意义", 5.6],[80.52, " 是否因此沉默沉默就好", 3.6],[87.21, " 找寻一种更抽象", 2.0],[89.25, " 建立一个泡泡", 1.8],[93.51, " 它有坚韧的壁", 1.6],[95.1, " 你称之为对生活的满意", 3.3],[99.72, " 局限的文字 引发无限共情意", 6.9],[120.57, " 终其一生 寻找自我与世界的角度", 5.6],[127.2, " 终其一生 寻找一种语言描述自己", 5.8],[133.89, " 倾听你 告诉你", 1.7],[135.6, " 同一个词语", 3.4],[140.16, " 每个人眼里不同的意义", 6.0],[147.21, " 是否因此沉默沉默就好", 3.4],[153.84, " 找寻一种更抽象", 2.1],[155.94, " 建立一个泡泡", 1.8],[160.14, " 它有坚韧的壁", 1.4],[161.82, " 你称之为对生活的满意", 3.3],[166.41, " 局限的文字 引发无限共情意", 6.9],[187.17, " 是否因此回击表达不放弃", 4.7],[193.86, " 起舞张扬不设界限与领地", 4.4],[199.74, " 整个大地联成了一片", 6.0],[206.64, " 去哪里都可以", 5.0],[213.09, " 你称之为广袤天地", 5.8],[244.54, "感谢支持", 6.5]]; </script>
点评
回复

使用道具

山外有山 山高为峰 版主勋章 樱果相依 闲花落
 楼主| 发表于 2024-6-10 23:17 | 显示全部楼层
请将代码复制到
http://mhh.52qingyin.cn/api/pcode/tiezi/
黑师音画编辑器里进行修改
点评
回复

使用道具

山外有山 山高为峰 版主勋章 樱果相依 闲花落
 楼主| 发表于 2024-6-13 23:14 | 显示全部楼层
点评
回复

使用道具

山外有山 山高为峰 版主勋章 樱果相依 闲花落
 楼主| 发表于 2024-6-13 23:14 | 显示全部楼层
点评
回复

使用道具

山外有山 山高为峰 版主勋章 樱果相依 闲花落
 楼主| 发表于 2024-6-13 23:14 | 显示全部楼层
点评
回复

使用道具

山外有山 山高为峰 版主勋章 樱果相依 闲花落
 楼主| 发表于 2024-6-13 23:14 | 显示全部楼层
点评
回复

使用道具

山外有山 山高为峰 版主勋章 樱果相依 闲花落
 楼主| 发表于 2024-6-13 23:14 | 显示全部楼层
点评
回复

使用道具

山外有山 山高为峰 版主勋章 樱果相依 闲花落
 楼主| 发表于 2024-6-13 23:14 | 显示全部楼层
点评
回复

使用道具

山外有山 山高为峰 版主勋章 樱果相依 闲花落
 楼主| 发表于 2024-6-13 23:15 | 显示全部楼层
点评
回复

使用道具

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|千山论坛

GMT+8, 2024-7-1 06:39

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表