doing flip by hand instead of grabbing some heavy library is actually decent. it's just recording the rects before the class change and then animating from that offset to zero. i like how they used.4 opacity during the move so you don't see the
ugly layout jitter when the elements resize mid-flight. it's better than having things just teleport into a grid view. still feels like it'd be a nightmare to manage if the container size changes while the animation is running though.
function setMode(m,anim){const a=new Map(items.map(e=>[e,e.getBoundingClientRect()]));SG.onclick=e=>{const b=e.target.closest('button');if(b)setMode(b.dataset.m,true)};}does anyone actually use this for large galleries or is the performance hit too much?
found this here:
https://dev.to/uimotion/building-a-list-to-grid-without-a-framework-5a1o