Here I've added a dummy action to give me 10 equally spaced keyframes, frames 1 to 10.
import bpy obj = bpy.context.object for x in range(10): obj.keyframe_insert('location', frame=x+1)
Now running this script gives me the result you are after
import bpy obj = bpy.context.object action = obj.animation_data.action x, y = action.frame_range for fcurve in action.fcurves: i = 1 L = (y - x) # preserve the first and last kfps print(fcurve.data_path, fcurve.array_index) while i < len(fcurve.keyframe_points) - 1: p = fcurve.keyframe_points[i-1].co.x fcurve.keyframe_points[i].co.x = p + L / 2 print(i, p + L / 2) L /= 2 i += 1
Use the interpolation mode found here in the graph editor:
You should also be able to do something like this with f-curve modifiers: