Seems similar to the default grid layout. Check that out. I created a module for my mvscomplete layout. It only does side scrolling, but you can look at that code on github as well. It's possible it could be adapted to a grid style with more math involved. It took me a while to wrap my head around what I got thus far. But it's simple to understand because there's no animations and such.