新年摇(马黑黑原创)
本帖最后由 朵拉 于 2024-3-5 08:46 编辑 <br /><br /><style>#papa {
margin: 0 0 0 calc(50% - 681px);
width: 1200px;
height: 675px;
background:
url('https://pic.imgdb.cn/item/65bf98b1871b83018a3bfa4e.jpg') no-repeat center/cover,
url('https://638183.freep.cn/638183/small/dolan.png') repeat-x 0 100%;
background-blend-mode: color-burn;
box-shadow: 3px 3px 20px #000;
position: relative;
display: grid;
place-items: center;
z-index: 1;
}
#papa::after {
position: absolute;
content: '';
inset: 0;
background: rgba(0,0,0,.5);
opacity: 0;
pointer-events: none;
animation: flash .1s infinite alternate var(--state);
}
.btnplay {
position: absolute;
cursor: pointer;
animation: rot 5s linear infinite var(--state);
}
.btnplay:nth-of-type(2) {
top: 2px;
width: 120px;
filter: invert(.8);
animation-delay: -.6s;
}
@keyframes rot { to { transform: rotate(360deg); } }
@keyframes flash { to { opacity: .5; } }
</style>
<div id="papa">
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=2118099495" loop autoplay></audio>
<img class="btnplay" src="https://638183.freep.cn/638183/small/4yc.png" alt="" title="播放/暂停" />
<img class="btnplay" src="https://638183.freep.cn/638183/small/4yc.png" alt="" title="播放/暂停" />
</div>
<script>
var btns = document.querySelectorAll('.btnplay');
var mState = () => papa.style.setProperty('--state', aud.paused ? 'paused' : 'running');
aud.addEventListener('playing', mState, false);
aud.addEventListener('pause', mState, false);
btns.forEach(btn => btn.onclick = () => aud.paused ? aud.play() : aud.pause());
</script> @马黑黑
马师 晚上好,学生交作业(只换了背景图,效果还不错),
请马师多指正哈{:4_190:} 朵拉 发表于 2024-2-4 22:07
@马黑黑
马师 晚上好,学生交作业(只换了背景图,效果还不错),
请马师多指正哈
人靠衣装马靠鞍{:4_170:} 精巧的设计 看不到底图?{:4_203:} 马黑黑 发表于 2024-2-4 22:09
精巧的设计
马师代码的绝妙{:4_190:} 红影 发表于 2024-2-4 22:31
看不到底图?
影宝 你看到的就是背景图哈{:4_204:} 朵拉 发表于 2024-2-4 22:51
马师代码的绝妙
{:4_190:} 欣赏佳作,问候朵拉。 没有看见图,白板 朵拉 发表于 2024-2-4 22:53
影宝 你看到的就是背景图哈
没有底图,只有黑黑的原来的东西呢{:4_204:} 有黑小人的舞蹈定格,有旋转的播放器,底图在闪光。 按了,还是那样纸呵{:4_203:}
页:
[1]