莲花池
本帖最后由 马黑黑 于 2023-2-8 12:11 编辑 <br /><br /><style>#papa {
--state: paused;
margin-top: -100px;
left: calc(50% - 81px);
transform: translateX(-50%);
width: 1024px;
height: 640px;
background: teal url('https://638183.freep.cn/638183/t23/webp/lmhxii.webp') no-repeat center/cover;
box-shadow: 8px 4px 18px hsla(0,0%,0%,.28);
display: grid;
place-items: center;
position: relative;
z-index: 1;
}
#papa::before, #papa::after {
position: absolute;
content: '';
left: -8px;
top: -8px;
right: -8px;
bottom: -8px;
border: 8px solid green;
border-radius: 6px;
pointer-events: none;
clip-path: inset(90% 0% 0% 0%);
animation: clip 12s infinite linear;
animation-play-state: var(--state);
}
#papa::after {
animation-delay: -6s;
}
#mplayer {
position: absolute;
bottom: 30px;
width: 200px;
height: 200px;
background: url('https://638183.freep.cn/638183/t23/1/lotus.png') no-repeat center/cover;
border-radius: 50%;
cursor: pointer;
animation: spin 10s infinite linear;
animation-play-state: var(--state);
}
@keyframes spin { to { transform: rotate(-1turn); } }
@keyframes clip {
25% { clip-path: inset(0% 0% 0% 90%); border-color: green; }
50% { clip-path: inset(0% 0% 90% 0%); border-color: lightgreen; }
75% { clip-path: inset(0% 90% 0% 0%); border-color: orange; }
100% { clip-path: inset(90% 0% 0% 0%); border-color: darkgreen; }
}
</style>
<div id="papa">
<div id="mplayer"></div>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=448520354.mp3" autoplay loop></audio>
</div>
<script>
(function() {
(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 = () => papa.style.setProperty('--state', aud.paused ? 'paused' : 'running');
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
mplayer.addEventListener('click', () => {
aud.paused ? aud.play() : aud.pause();
});
FS({
pa: papa,
set: 'color: green; background: transparent; border: 2px solid green; bottom: 6px;',
});
})();
</script>
帖子代码
<style>
#papa {
--state: paused;
left: calc(50% - 81px);
transform: translateX(-50%);
width: 1024px;
height: 640px;
background: teal url('https://638183.freep.cn/638183/t23/webp/lmhxii.webp') no-repeat center/cover;
box-shadow: 8px 4px 18px hsla(0,0%,0%,.28);
display: grid;
place-items: center;
position: relative;
z-index: 1;
}
#papa::before, #papa::after {
position: absolute;
content: '';
left: -8px;
top: -8px;
right: -8px;
bottom: -8px;
border: 8px solid green;
border-radius: 6px;
pointer-events: none;
clip-path: inset(90% 0% 0% 0%);
animation: clip 12s infinite linear;
animation-play-state: var(--state);
}
#papa::after {
animation-delay: -6s;
}
#mplayer {
position: absolute;
bottom: 30px;
width: 200px;
height: 200px;
background: url('https://638183.freep.cn/638183/t23/1/lotus.png') no-repeat center/cover;
border-radius: 50%;
cursor: pointer;
animation: spin 10s infinite linear;
animation-play-state: var(--state);
}
@keyframes spin { to { transform: rotate(-1turn); } }
@keyframes clip {
25% { clip-path: inset(0% 0% 0% 90%); border-color: green; }
50% { clip-path: inset(0% 0% 90% 0%); border-color: lightgreen; }
75% { clip-path: inset(0% 90% 0% 0%); border-color: orange; }
100% { clip-path: inset(90% 0% 0% 0%); border-color: darkgreen; }
}
</style>
<div id="papa">
<div id="mplayer"></div>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=448520354.mp3" autoplay loop></audio>
</div>
<script>
(function() {
(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 = () => papa.style.setProperty('--state', aud.paused ? 'paused' : 'running');
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
mplayer.addEventListener('click', () => {
aud.paused ? aud.play() : aud.pause();
});
FS({
pa: papa,
set: 'color: green; background: transparent; border: 2px solid green; bottom: 6px;',
});
})();
</script>
真的很美,欣赏一会。 来的巧,赶上黑黑的新东东{:4_199:} 哇瑟~~又有钱{:4_173:} 黑黑这个创意,播放器小图要和整体背景相吻合才有意思 这个流动是在外框 庶民 发表于 2023-2-8 12:23
真的很美,欣赏一会。
{:4_190:} 小辣椒 发表于 2023-2-8 12:56
来的巧,赶上黑黑的新东东
简单而美,还有钱钱{:4_170:} 小辣椒 发表于 2023-2-8 12:57
黑黑这个创意,播放器小图要和整体背景相吻合才有意思
{:4_181:} 雨中悄然 发表于 2023-2-8 13:04
这个流动是在外框
下午好 我又是能看图面,看不了效果。不过这荷花池好美啊。夏天在这里里坐会,肯定神清气爽{:4_187:} 看了看代码,这个流动边弄到papa上去了, 又是一种表现方式{:4_199:} 马黑黑 发表于 2023-2-8 13:24
下午好
好不好呢 欣赏老师佳作!