camera zoom in/out position based on object's speed

So… I kinda asked a similar question before but I wasn’t being clear enough…

So I have this camera in the scene that’s following a gameobject from the top… this gameobject moves around and can speed up or slow down. I’m trying to write a code for the camera so that as the gameobject slows down, the camera slowly zooms closer to the gameobject, and as the gameobject speeds up, the camera zooms farther away… so the distance of the camera from the gameobject is based upon the speed of the gameobject… I tried doing this by setting up two other gameobject that the camera would use to move from one position to another, but it’s just not acting the way I want it to, and something tells me that it’s just not the right way to do it. Anyone know of a good approach to set up a camera motion like this? any help would be appreciated, thanks!

Did you ever find a solution for this? I’ve got a similar problem, I’ve got the zooming portion down (since it’s an orthographic camera), but I can’t figure out how to properly input the speed. If you can input the speed, you could use its magnitude as a multiplier to increase an offset modifier. (Which is pretty much what I’m trying, but it needs a float and I have a Vector3…)