Dot Grid animation

I am struggling with achieving 2 things:

  • I would like to hide elements that are overflowing the available space in the layout

  • I would like let fill the available space with grid space while still respecting the padding around the layout. So when the layout grows or shrink the gap sizes increases or decreases.

    Does anybody has idea how to achieve these effects or how to do something similar?

Clipboard-20260219-222317-978.mp4