遗世独立
本帖最后由 马黑黑 于 2023-2-9 12:55 编辑 <br /><br /><style>#papa {
margin: -120px 0 0 calc(50% - 593px);
width: 1024px;
height: 640px;
background: teal url('https://638183.freep.cn/638183/t23/webp/yiuiduli.webp') no-repeat center/cover;
box-shadow: 8px 6px 18px rgba(0,0,0,.35);
border-radius: 8px;
position: relative;
z-index: 1;
}
#mplayer {
--state: paused;
--angle: 360deg;
width: 100px;
height: 100px;
top: 50px;
left: 50px;
background: url('https://638183.freep.cn/638183/t23/1/ub4.webp') no-repeat center/cover;
border-radius: 50%;
display: grid;
place-items: center;
cursor: pointer;
position: absolute;
}
#circle {
position: absolute;
top: -6px; left: -6px; bottom:-6px; right: -6px;
border: 4px dotted #eee;
border-radius: 50%;
display: grid;
place-items: center;
animation: rot infinite 10s linear;
animation-play-state: var(--state);
}
#circle::before, #circle::after {
position: absolute;
content: '';
top: -12px; left: -12px; bottom:-12px; right: -12px;
border: 4px dotted #fff;
border-radius: 50%;
animation: rot infinite 5s linear;
animation-play-state: var(--state);
--angle: -360deg;
}
#circle::after {
top: -20px; left: -20px; bottom:-20px; right: -20px;
border-color: #ddd;
animation-duration: 12s;
--angle: 360deg;
}
@keyframes rot {
from { transform: rotate(0); }
to { transform: rotate(var(--angle)); }
}
</style>
<div id="papa">
<div id="mplayer">
<span id="circle"></span>
</div>
</div>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=1489883825.mp3" autoplay loop></audio>
<script>
(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 mState = () => mplayer.style.setProperty('--state', aud.paused ? 'paused' : 'running');
aud.addEventListener('play', () => mState());
aud.addEventListener('pause', () => mState());
mplayer.addEventListener('click', () => aud.paused ? aud.play() : aud.pause());
FS({
pa: papa,
set: 'color: snow; background: transparent; border: 2px solid snow; top: 180px;left:60px',
});
</script>
代码
<style>
#papa {
margin: 0 0 0 calc(50% - 593px);
width: 1024px;
height: 640px;
background: teal url('https://638183.freep.cn/638183/t23/webp/yiuiduli.webp') no-repeat center/cover;
box-shadow: 8px 6px 18px rgba(0,0,0,.35);
border-radius: 8px;
position: relative;
z-index: 1;
}
#mplayer {
--state: paused;
--angle: 360deg;
width: 100px;
height: 100px;
top: 50px;
left: 50px;
background: url('https://638183.freep.cn/638183/t23/1/ub4.webp') no-repeat center/cover;
border-radius: 50%;
display: grid;
place-items: center;
cursor: pointer;
position: absolute;
}
#circle {
position: absolute;
top: -6px; left: -6px; bottom:-6px; right: -6px;
border: 4px dotted #eee;
border-radius: 50%;
display: grid;
place-items: center;
animation: rot infinite 10s linear;
animation-play-state: var(--state);
}
#circle::before, #circle::after {
position: absolute;
content: '';
top: -12px; left: -12px; bottom:-12px; right: -12px;
border: 4px dotted #fff;
border-radius: 50%;
animation: rot infinite 5s linear;
animation-play-state: var(--state);
--angle: -360deg;
}
#circle::after {
top: -20px; left: -20px; bottom:-20px; right: -20px;
border-color: #ddd;
animation-duration: 12s;
--angle: 360deg;
}
@keyframes rot {
from { transform: rotate(0); }
to { transform: rotate(var(--angle)); }
}
</style>
<div id="papa">
<div id="mplayer">
<span id="circle"></span>
</div>
</div>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=1489883825.mp3" autoplay loop></audio>
<script>
(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 mState = () => mplayer.style.setProperty('--state', aud.paused ? 'paused' : 'running');
aud.addEventListener('play', () => mState());
aud.addEventListener('pause', () => mState());
mplayer.addEventListener('click', () => aud.paused ? aud.play() : aud.pause());
FS({
pa: papa,
set: 'color: snow; background: transparent; border: 2px solid snow; top: 180px;left:60px',
});
</script>
这个刚才怎么没有看见{:4_203:} 有钱的{:4_170:} 这个新东东,可惜刚才没有看见,否则可以套用做一个的,现在得干活了 赚够钱晚上上来做 黑黑太豪爽了,发教程好送钱,纯土豪{:4_178:} 感谢黑黑精彩分享{:4_187:} 钱拿走,人离开,晚上见 我来捧场的。 这个播放器做得真漂亮,恰似美图上的一轮明月。 三个不同转速的dotted小点点,构成了新的播放器玩法,真漂亮{:4_187:} 这回当中的不转了,应该不会晕了{:4_173:} 非常清爽可爱的播放器。三个圆圈的颜色太接近了,看着就一种颜色一样。 黑黑真灵光,总能想出新的玩法{:4_199:} 小辣椒 发表于 2023-2-9 14:05
这个刚才怎么没有看见
中午发的 小辣椒 发表于 2023-2-9 14:05
有钱的
有的有的 小辣椒 发表于 2023-2-9 14:06
这个新东东,可惜刚才没有看见,否则可以套用做一个的,现在得干活了
这个也是简单的,就是CSS代码多一些 红影 发表于 2023-2-9 16:01
这回当中的不转了,应该不会晕了
是的,尝试一下让一个子元素连同它的两个伪元素转动,播放控制器主体元素不动 红影 发表于 2023-2-9 16:02
非常清爽可爱的播放器。三个圆圈的颜色太接近了,看着就一种颜色一样。
色差可以尝试改变一下,我这个是为了贴合主体,素雅一点好