|  | 
 
 楼主|
发表于 2024-10-29 13:21:23
|
显示全部楼层  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://file.uhsea.com/2410/13d229cd31ca944741369d1d59cd95e31F.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/27206371.mp3" width="2">
 
 | 
 |