cocosCreator中PageView自动翻页
let pageList = this._view._PageC_List;
let pageCount = pageList.getPages().length; // 获取翻页容器长度
let duration = 3; // 自动翻页时间,s
let currentPageIndex = 0; // 当前页数
let direction = 1; // 翻页方向
let scrollTiem = 1; // 翻页时间
pageList.schedule(()=>{
if(currentPageIndex === pageCount-1){
direction = -1;
}else if(currentPageIndex === 0){
direction = 1;
}
currentPageIndex += direction;
pageList.scrollToPage(currentPageIndex,scrollTiem);
},duration)
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 三尺青锋!
评论