To add to Savlons answer:
There are two ways of doing this
Vector2D objects(Assuming your positions are vectors):
diffVec.normlize(); //Assuming it's applied on the vector itself
// and does not return a new one.
//This vector is now a unit vector which represents the heading/Direction
//without the "speed" (Well its speed is 1, more precisely its MAGNITUDE is 1).
camera.velocity = diffVec;
The normalize function would probably look something like this:
float len = length();
this.x /= len;
this.y /= len;
Now if you're not using vectors this could be translated to:
float dx = destinationX-positionX;
float dy = destinationY-positionY;
Let's pretend dx and dy are the components of an imaginary vector. ( And by components I mean the x and y properties ).
We can perform the same calculations as we have in our Vector2D class:
First we need to "normalize" our imaginary vector by dividing it by its length. Pythagoras theorem, remember that one?
float length = sqrtf(dx*dx+dy*dy);
Now we use this to normalize our imaginary vector:
Now if we were to apply the Pythagoras theorem on our new dx and dy value you will notice that the length is 1. Meaning that we have a direction, and a magnitude of 1. To change it to our speed simply multiply each component by it.
dx *= speed;
dy *= speed;
cam.velocityX = dx;
cam.velocityY = dy;
Imagine a vector to be an arrow with a specific length. When you normalize it you bring the length to one.
So if you multiply it ( by a scalar ), the speed in this case, the x and y components adjust accordingly that the length of the vector is the speed it's multiplied with.