|
代码分享:
<style>
#waik {
margin: auto;
width: 760px;
height: 500px;
background: #000;
position: relative;
}
#waik::before {
content: 'nihao';
position: absolute;
width: 760px;
height: 500px;
background: url('/data/attachment/forum/202204/04/183311aa7vo49o43bpubtp.gif') no-repeat center/cover;
opacity: .4;
}
</style>
<div id="waik"></div>
<script>
let waik = document.getElementById('waik');
let step = -1, all = 50, angle = 100;
setInterval(flash, 10);
function flash() {
all = all + step;
if(all == -angle) step = -step;
if(all == angle) step = -step;
waik.style.background = `conic-gradient(at 50% 0, #000 ${all}deg, #fff, #000)`;
}
</script>
|