|
楼主 |
发表于 2024-10-18 19:35:43
|
显示全部楼层
IP:河北石家庄
你看吧。这我发的帖子的代码。
<style>
#oBlk {
margin-left: 50% ; left: -598px;
margin-top:110px;
width: 1210px;
height: 640px;
box-shadow: 3px 3px 10px #000;
overflow: hidden;
position: absolute;
}
#oBlk::before,
#oBlk::after {
position: absolute;
content: '';
left: var(--curX0);
top: 0px;
width: 100%;
height: 100%;
background: url('https://pic.imgdb.cn/item/6711e41ad29ded1a8c3c63ab.jpg') no-repeat center / cover;
}
#oBlk::after {
left: var(--curX1);
transform: scaleX(-1);
}
</style>
<div id="oBlk"></div>
<div style="height:640px;"></div>
<script>
{
let blkWidth = oBlk.offsetWidth;
let step = 1.0, tune = 0,
curX0 = 0,
curX1 = blkWidth,
raf;
let moving = () => {
/*
//自左向右
curX0 += step;
curX1 += step;
if(curX0 >= blkWidth) curX0 = -blkWidth;
if(curX1 >= blkWidth) curX1 = -blkWidth;
*/
//自右向左
curX0 -= step;
curX1 -= step;
if(curX0 <= -blkWidth) curX0 = blkWidth;
if(curX1 <= -blkWidth) curX1 = blkWidth;
tune = curX1 + (curX0 >= 0 ? 1 : -1);
oBlk.style.setProperty('--curX0', curX0 + 'px');
oBlk.style.setProperty('--curX1', tune + 'px');
raf = requestAnimationFrame(moving);
};
moving();
}
</script></div></div><br><br><br><br><br><video autoplay="" controls="" height="1" src="https://link.hhtjim.com/kw/187721696.mp3" width="2"> |
|