const looper = cb => {
    let lastTime = Date.now()

    const fn = time => {
        cb(time - lastTime)
        lastTime = time
        requestAnimationFrame(fn)
    }

    fn(lastTime)
}

export default looper
