Use requestAnimationFrame to debounce.