这次内容我们接着介绍在swiper页面的翻页动画--3d覆盖流效果。
首先搭建swiper页面,设置css样式,为了观看效果,这一章依然在slide当中添加背景图片。
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide"><img src="logo.png"></div>
<div class="swiper-slide" style="background-image:url(img/4.jpg)"></div>
<div class="swiper-slide" style="background-image:url(img/5.jpg)"></div>
<div class="swiper-slide" style="background-image:url(img/6.jpg)"></div>
<div class="swiper-slide"><img src="logo.png"></div>
</div>
<div class="swiper-pagination"></div>
</div>然后与我们之前的3D方块效果使用方法一样,添加属性,并对动画进行设置。
var swiper = new Swiper('.swiper-container',{
pagination:'.swiper-pagination',
grabCursor:true,
centeredSlides:true,
slidesPerView:'auto',
effect:'coverflow', //动画效果:3D覆盖流效果
coverflow:{
rotate:50,
stretch:0,
depth:100,
modifier:1,
slideShadows:true
}
});我们的动画设置当中都设置了什么呢?
coverflow:{
rotate:50, //旋转的角度
stretch:0, //拉伸
depth:100, //深度
modifier:1, //修正值(该值越大前面的效果越明显)
slideShadows:true //页面阴影效果
}最好我们的动画效果与分组显示来一起使用,单独使用效果不好。
以上就是swiper的基础使用(十七)的内容,更多相关内容请关注PHP中文网(www.php.cn)!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号