DIR : /home/kozerus/public_html/cropex/node/node_modules/react-smooth/src/setRafTimeout.js

/home/kozerus/public_html/cropex/node/node_modules/react-smooth/src

function safeRequestAnimationFrame(callback) {
  if (typeof requestAnimationFrame !== 'undefined') requestAnimationFrame(callback);
}

export default function setRafTimeout(callback, timeout = 0) {
  let currTime = -1;

  const shouldUpdate = now => {
    if (currTime < 0) {
      currTime = now;
    }

    if (now - currTime > timeout) {
      callback(now);
      currTime = -1;
    } else {
      safeRequestAnimationFrame(shouldUpdate);
    }
  };

  requestAnimationFrame(shouldUpdate);
}
//


koh5_pano



Your browser does not support the HTML5 canvas element.


Drag mouse to navigate.

Navigation





17.Aug.2010, Martin Wengenmayer