朵拉 发表于 2024-3-12 21:28

小美满(马黑黑原创)

本帖最后由 朵拉 于 2024-3-12 21:32 编辑 <br /><br /><style>
#papa { margin: 0 0 0 calc(50% - 593px); width: 1024px; height: 640px; background: url('https://pic.imgdb.cn/item/65f058ea9f345e8d03515c4a.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; overflow: hidden; z-index: 1; position: relative; }
#btnplay { position: absolute; width: 100px; left: 0; top: 10px; filter: hue-rotate(260deg) opacity(.8); transition: 6s; cursor: pointer; animation: rot 8s linear infinite var(--state); }
#vid { position: absolute; top: -130px; left: -150px; width: 400px; height: 400px; object-fit: cover; border-radius: 50%; opacity: .6; transition: 6s; mix-blend-mode: screen; pointer-events: none; }
@keyframes rot { to { transform: rotate(360deg); } }
</style>

<div id="papa">
    <audio id="aud" src="https://music.163.com/song/media/outer/url?id=2124381474" autoplay loop></audio>
    <video id="vid" src="https://img.tukuppt.com/video_show/15653652/00/85/69/60ff8be36ed3c.mp4" loop></video>
    <img id="btnplay" src="https://638183.freep.cn/638183/web/svg/sunfl-2.svg" alt="" />
</div>

<script>
(function() {
    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 = '点击播放',vid.pause()) : (papa.style.setProperty('--state','running'),btnplay.title = '点击暂停',vid.play());
    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}; };
    aud.onplaying = aud.onpause = () => mState();
    btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
    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 === "player" || 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;`; vid.style.cssText += `left: ${x - 150}px;`; } else { let xx = e.offsetX || e.layerX; if (xx + sonSize > bodyWidth) xx -= sonSize; btnplay.style.cssText += `left: ${xx}px;`; vid.style.cssText += `left: ${xx - 150}px;`; } }, 400);
};
})();
</script>

朵拉 发表于 2024-3-12 21:32

@马黑黑
老师 晚上好,学生交作业,请指正哈{:4_190:}

红影 发表于 2024-3-12 21:43

很温暖的帖子。欣赏朵宝好帖{:4_187:}

小辣椒 发表于 2024-3-12 23:08

朵拉速度的,每次作业都是速度完成{:4_178:}

小辣椒 发表于 2024-3-12 23:09

欣赏朵拉好制作{:4_171:}
页: [1]
查看完整版本: 小美满(马黑黑原创)