change frame of a key


In first i apologize if my english is realy bad ^^’

I’m new in the python scripting and i want to change the frame of a key by script to have a thing like that :

And i want to do it for all keys but not the first.

Any ideas?

Sparadrax :smiley:

You need to find the right keyframe in the action’s fcurve and change its x coordinate:

import bpy

ob = bpy.context.object

if (ob is not None and
    ob.animation_data is not None and
    ob.animation_data.action is not None):
    for fcurve in ob.animation_data.action.fcurves:
        # grab location.z curve
        if fcurve.data_path == "location" and fcurve.array_index = 2:
            for k in fcurve.keyframe_points:
                # find keyframe at frame 60 and move
                if == 60:
           = 77