arrive = function arrive(update) {
    var maxVelocity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
    var friction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.01;

    return function (cb) {
        var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
        var to = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;

        update(cb, from, to, function (state, cancel) {
            // distance to target
            var distance = state.destination - state.position;
            var halfway = state.origin + (state.destination - state.origin) * 0.5;

            // update velocity based on distance
            state.velocity += (-(halfway - state.origin) + distance) * 2 * friction;

            // update position by adding velocity
            state.position += state.velocity < 0 ? Math.max(state.velocity, -maxVelocity) : Math.min(state.velocity, maxVelocity);

            // we've arrived if we're near target and our velocity is near zero
            if (state.origin < state.destination && state.position >= state.destination || state.origin >= state.destination && state.position <= state.destination) {
                cancel();
                state.velocity = 0;
                state.position = state.destination;
            }
        });
    };
}
Arrive at destination
@param update
@param maxVelocity
@param friction