code: function oncePerAnimationFrame(fn) {
    let animationId = null;
    let argsToPass = null;
    return function(...args) {
      argsToPass = args;
      if (animationId !== null) {
        return;
      }
  
      animationId = requestAnimationFrame(() => {
        fn.call(this, ...argsToPass);
        animationId = null;
        argsToPass = null;
      });
    };
  }
docs: Create a function that calls the given function `fn` only once per animation
  frame.
  
  @param {Function} fn
  @returns {Function}