I would use time based animation. In each rAF iteration, you can measure the temporal relationship to the previous iteration. Knowing this delta time and the "distance" in pixels, you can calculate the necessary speed to get 2 seconds.
This article from Mozilla Hacks discusses various considerations for animating at a constant speed (pixel / second). Here is a snippet that explains the basic concept:
animLoop(function( deltaT ) { elem.style.left = ( left += 10 * deltaT / 16 ) + "px"; if ( left > 400 ) { return false; } });
source share