1
$\begingroup$

Can't find any information about very useful feature for animation and specially motion graphics, I will very appreciate any help (before i'm starting asking my friends to write a plugin...):enter image description here

$\endgroup$
  • $\begingroup$ Like bezier curves in the graph editor? $\endgroup$ – JakeD Aug 29 '16 at 22:28
  • $\begingroup$ Hello, thanx for being interested in my question. no, bezier curves controls what happening in between of two keyframes - i want to control a group of keyframes. for example - to automate a bouncing ball animation. $\endgroup$ – LDCO Aug 29 '16 at 22:37
1
$\begingroup$

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)

enter image description here

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

enter image description here

$\endgroup$
  • $\begingroup$ Thnks very much! I thought I wont get an answer so I started sort of wring my own script, with some issues - link. Tell me please - can I use this script to make this kind of think link? $\endgroup$ – LDCO Sep 7 '16 at 22:31
  • $\begingroup$ Yes can do most anything. In JS example link 0 gives us end result above, 50, starting point above, not sure where you've gone with 100. Maybe ask another q? There are some quick methods to set all keyframe coords at once from a flat list. $\endgroup$ – batFINGER Sep 8 '16 at 6:47
0
$\begingroup$

Use the interpolation mode found here in the graph editor:

enter image description here

You should also be able to do something like this with f-curve modifiers:

https://www.blender.org/manual/editors/graph_editor/fcurves/fmodifiers.html

$\endgroup$
  • $\begingroup$ maybe i didn't explained well the issue... what your are proposing is concern only ONE keyframe, what i'am trying to do is to manipulate a group of existing keyframes. For example in blender there is no possibility to offset a keyframes of different objects, there is a plugin for this - github.com/mrachinskiy/commotion $\endgroup$ – LDCO Aug 30 '16 at 1:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.