How to make a instant change in specific frames?

Hi,

I’ve been stuck at this problem for a whole day and didn’t have a solution. It might be a easy thing but since I am still new to python and scripting, I could really need some help.

All I want to do is following: let’s say I have an object and have two key frames of rotations. Right now if I specify these two frames, result animation is the object gradually rotation from the beginning to the end. However, I would like this object to make fast rotation at a short time. Imagine someone forgot his key on his way to work, the time he realizes he decide to turn and go back, this turn would happen almost instantly rather than gradually.

By manipulating the graph editor, I can achieve this approximately. However, I have multiple objects and it’s almost impossible to change this for every objects between every two key frames.

Does anyone know how to do that through scripting?

Thank you so much for reading my post and looking forward to the solutions.

Philip

Here’s a way shown how to create fcurve keyframes (low level):
http://www.blender.org/documentation/blender_python_api_2_70a_release/info_quickstart.html#animation

You see the access path, which is:
Object.animation_data.action.fcurves[#].keyframe_points

Also read:
Blender/Python Addon Tutorial: a step by step guide on how to write an addon from scratch

Every keyframe point has the properties .handle_left and .handle_right (both 2D vectors):
http://www.blender.org/documentation/blender_python_api_2_70a_release/bpy.types.Keyframe.html?highlight=handle_left%20handle_right#bpy.types.Keyframe.handle_left

You can tweak the coordinates to achieve a more dramatic easing.

Note that the latest test builds include new builtin interpolation types:
https://developer.blender.org/T22084