无缝滚动
Page({ data: { speed: 0.2, //滚动速度 distance: 0, //初始滚动距离 size:14, conut: 10, direction: 'top' , //滚动方向 interval: 20, // 时间间隔 textheight:19 }, onShow: function () { // 页面显示 var vm = this ; var height = vm.data.textheight * vm.data.conut; //高度 vm.setData({ height: height }); vm.run2(); }, run2: function () { var vm = this ; var interval = setInterval( function () { if (-vm.data.distance < vm.data.height) { vm.setData({ distance: vm.data.distance - vm.data.speed }); } else { if (-vm.data.distance >= vm.data.height) { vm.setData({ distance: 0 }); clearInterval(interval); vm.run2(); } } }, vm.data.interval); } }) |
10条到第1条有间隔,要怎么弄呀