尝试使用GSAP在http://css3.bradshawenterprises.com/cfimg/#cfimg3中实现交叉渐变滑块, 我可以为一张幻灯片做动画,但是其他幻灯片无法做到,基本上很难将时间轴和错开组合起来
代码笔:https://codepen.io/shmdhussain/pen/MvjEom`
// instantiate TimelineMax
const tl = new TimelineMax({ repeat: -1 });
tl.to('.test', 2, {opacity:1, scale:1, ease: Power0.easeNone})
.to('.test', 4, {scale:1.5,ease: Power0.easeNone}, )
.to('.test', 2, {opacity: 0, scale:1,scale:1, ease: Power0.easeNone});

img{
/* width:100%;
height:100%; */
position:absolute;
top:0;
left:0;
}
img:first-child{
position:relative
}
div{
width:400px;
height:200px;
overflow:hidden;
position:relative;
}
.test{
//opacity: 0;
}

<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.2/TweenMax.min.js"></script>
<div>
<img src="http://via.placeholder.com/400x200" alt="">
<img class="test" src="https://www.skynewsarabia.com/web/images/2017/08/01/969105/400/200/1-969105.jpg" alt="bb">
<!-- <img class="test" src="https://www.skynewsarabia.com/web/images/2017/08/01/969022/400/200/1-969022.jpg" alt="bb">
<img class="test" src="https://www.skynewsarabia.com/web/images/2017/07/31/968732/400/200/1-968732.JPG" alt="bb"></div> -->
&#13;
`
答案 0 :(得分:2)
您可以尝试使用position参数或stagger
方法来创建重叠。虽然基于您的代码,似乎position参数是更好的选择:
https://greensock.com/position-parameter
最后,我的目的不是要阻止人们在这里询问GSAP相关问题,你会在GreenSock论坛上获得更好,更快的支持: