how to combine Stagger and timeline in GSAP
尝试使用GSAP来实现http://css3.bradshawenterprises.com/cfimg/#cfimg3中的交叉淡入淡出滑块,
我可以为一张幻灯片做动画,不能为其他幻灯片做动画,基本上很难将时间轴和交错
代码笔:https:// codepen.io / shmdhussain / pen / MvjEom`
1 2 3 4 5 6 | // 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}); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 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; } |
1 2 3 4 5 6 | <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.2/TweenMax.min.js"> <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"> --> |
`
您可以尝试使用position参数或
https://greensock.com/position-parameter
最后,我的目的不是要劝阻人们在这里提出GSAP相关问题,您将在GreenSock论坛中获得更好,更快的支持:
https://greensock.com/forums