黑桃A(马黑黑原创)
本帖最后由 朵拉 于 2024-3-14 20:22 编辑 <br /><br /><style>#papa { margin: 0 0 0 calc(50% - 593px); width: 1024px; height: 640px; background: url('https://pic.imgdb.cn/item/65f2eb3b9f345e8d03371e77.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; overflow: hidden; position: relative; z-index: 1; --y0: -420px; }
li-zi { position: absolute; top: 50%; width: 2px; height: 100px; background: linear-gradient(to bottom, #2D9DF3, #2D9DF3, transparent); }
#btnplay { position: absolute; left: 0; top: 10px; width: 80px; height: 80px; background: rgba(20,20,200,.6) url('https://638183.freep.cn/638183/t22/btn/star.png') no-repeat center/cover; border-radius: 50%; border: thick solid; border-color: #B0E0E6 #00BFFF #4682B4 #F0F8FF; transition: 8s; cursor: pointer; animation: rot 6s linear infinite var(--state), bgsize .5s linear infinite alternate var(--state); }
li-zi::before { position: absolute; content: ''; left: calc(50% - 2px); top: 0; width: 4px; height: 4px; border-radius: 50%; background: lightblue; }
@keyframes moving { from { opacity: 0; transform: translate(0,0); } to { opacity: 1; transform: translate(0, var(--y0)); } }
@keyframes rot { to { transform: rotate(360deg); } }
@keyframes bgsize { to { background-size: 150%; }}
</style>
<div id="papa">
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=1843762883" autoplay loop></audio>
<div id="btnplay"></div>
</div>
<script>
(function() {
let all = 200;
for(let i = 0; i < all; i ++) { let lz = document.createElement('li-zi'); let left = Math.random() * 100; lz.style.cssText += ` left: ${left}%; animation: moving ${Math.random() * 10 + 10}s -${Math.random() * 10}s infinite var(--state); `; papa.prepend(lz); }
let sF = document.createElement('script');
sF.src = 'https://638183.freep.cn/638183/web/api/fullscreen.js';
sF.charset = 'utf-8';
document.querySelector('body').appendChild(sF);
sF.onload = () => FS({papa: '#papa', css: '--bg: transparent; --color: #eee; bottom: 10px; left: 48%;'});
let mState = () => aud.paused ? (papa.style.setProperty('--state','paused'),btnplay.title = '点击播放') : (papa.style.setProperty('--state','running'),btnplay.title = '点击暂停');
let getOffsetPos = (ele) => { let x = ele.offsetLeft, y = ele.offsetTop, pa = ele.offsetParent; while(pa != null) { x += pa.offsetLeft; y += pa.offsetTop; pa = pa.offsetParent; } return {x, y}; };
let movTimer = null, paWidth = papa.clientWidth, sonSize = btnplay.clientWidth, bodyWidth = document.body.clientWidth, paOffset = getOffsetPos(papa).x;
document.onmousemove = function(e) { clearTimeout(movTimer); movTimer = setTimeout(function() { if (e.target.id === "btnplay" || e.target.id == 'btnFs') return; if (document.fullscreenElement === null) { let x = e.pageX; if (x < paOffset) x = paOffset; x = x - paOffset; if (x + sonSize >= paWidth) x = paWidth - sonSize; btnplay.style.cssText += `left: ${x}px`; papa.style.setProperty('--left', `${x + 40}px`); } else { let xx = e.offsetX || e.layerX; if (xx + sonSize > bodyWidth) xx -= sonSize; btnplay.style.cssText += `left: ${xx}px;`; papa.style.setProperty('--left', `${xx + 40}px`); papa.style.setProperty('--y0', `-${window.innerHeight / 2 + 100}px`); } }, 400); };
aud.onpause = aud.onplaying = () => mState();
btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
})();
</script> @马黑黑
老师 晚上好,学生交作业,请指正哈{:4_190:} 漂亮! 漂亮,欣赏朵宝好帖{:4_204:} 朵拉这个真漂亮 优秀作业,马师的得意弟子{:4_172:} 欣赏一下。画面不错,音乐挺好
页:
[1]