To add a float track, double click on the timeline node, and inside hit the Track button with a green plus (+) icon on it and select the Float Track option like this:
You can add new keys to your float track by right clicking on the graph and selecting the Add Key option. Here’s an example on how you can place the keys:
To do that, select your keys and then right click on one of them instead of right clicking on the graph, and hit the Break option. You can also adjust the tangents of the individual keys.
Oh and also, don’t forget to assign a reference to our Camera variable on Begin Play. Also note that which component of our camera’s relative location to update depends on your orientation, for example it might be Y in your case.
Note for those who would like to implement the same feature to a 3D game, instead of working on the camera, adjust the length of the spring arm.