Issue mask in content scrollview cocos creator

I use masked items in the scrollview and that mask causes the scrollview to lag. Please give me a solution

Hi,
I don’t know which version of cocos creator you are using.
I only use the 2.4.x version, don’t know if in 3.x it’s fixed.
But in 2.4.x the items outside the cocos mask still render, making it lag.
You can fix it by hiding the items outside the mask like this:

  private hideOutMask() {
    const { width, height } = this.view.node;
    const viewRect = cc.rect(-width / 2, -this.layout.node.y - height / 2, width, height);
    for (const node of this.layout.node.children) {
      if (viewRect.intersects(node.getBoundingBox())) node.opacity = 255;
      else node.opacity = 0;
    }
  }
1 Like

iI did it but there are items that are partly inside the mask and cannot be hidden. The mask actually causes scrolling to lag, not because of the item outside . thank you <3