Function runAnimation

Run function as animation using requestAnimationFrame

  • Parameters

    • fn: () => any

      Function to be run as animation

    • autoStart: boolean = true

      If animation should start right away or just return callbacks

    Returns { startAnimation: () => void; stopAnimation: () => void }

    Callbacks to start animation (startAnimation) and stop animation (stopAnimation)