#2 Use requestAnimationFrame to improve performance. #3 Use node.getboundingclientrect instead of node.offest.