cocos creator滚动渲染优化
2019-12-19 本文已影响0人
神大人korose
//滚动优化
RollingOptimization:function (view,list) {
let viewPos = view.parent.convertToWorldSpaceAR(view.getPosition());
let viewBox = cc.rect(viewPos.x-view.width/2,viewPos.y-view.height/2,view.width,view.height);
cc.log(viewBox)
for (let i = 0; i < list.length; i++) {
if (viewBox.intersects(list[i].getBoundingBoxToWorld())) {
list[i].opacity = 255;
cc.log("255",i)
} else {
list[i].opacity = 0;
cc.log("0",i)
}
}
},