So I have an F-Curve (Bezier Curve) made of frame-by-frame keyframes, which I'm viewing in the graph editor. I need to make another F-Curve that is the integral of this one. Current F-Curve

Is this possible in blender, or is there a way I can export this into another software?



1 Answer 1


Ok, I figured it out. For anyone else wondering, I used a Python script in Blender to integrate the F-Curve.

Essentially, an integral is just a continuous sum. This means that we can find points on the integral by creating a variable that starts at zero, and at every keyframe, we add the value of that keyframe to the variable. Then, we can replace every old keyframe with the current value of the variable at that frame. This will give an approximation of the integral of the curve, shown below in white.

Original Graph (Black) and Integral (White)

For anyone else wanting to try, here is the code I used:

import bpy

context = bpy.context
obj = context.object
action =  context.object.animation_data.action

val = 0
for fcurve in action.fcurves:
    print("%s[%d]" % (fcurve.data_path, fcurve.array_index))
    for kfp in fcurve.keyframe_points:
        for prop in ["co"]:
            co = getattr(kfp, prop)
            val += co[1] / 24.218784
            print("%.f, %.4f" %  co[:], val)
            obj.constraints[0].offset = val
            obj.keyframe_insert(data_path='constraints[0].offset', frame=(co[0]))

This is not my code, I found most of it in this post: Exporting animation F-curve points from the Graph Editor

You will also need to change the attributes in the code based on what you are keyframing. In my case, I used obj.constraints[0].offset. Also, the integral will not be scaled correctly, and you need to scale it to fit your ideal range by dividing it by a constant, in my case 24.218784.

I know it's not a perfect solution, but I hope it helps someone. Thanks again to batFINGER for providing the code.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .