1
$\begingroup$

Is there any way i can randomize automatically the keyframes position between a lot of objects? for example, i have 10 objects, with the same animation, and i want to move the keyframes for every single objects on the timeline, so one of those will start at keyframe 1, the other at keyframe 10, the others at 20, 25, etc. I need to know this so i can save time and also making a lot of random animations fast without having to enter in each dopesheet of each item, because maybe then ill have to animate like 100 objects..

$\endgroup$
  • 1
    $\begingroup$ It is possible to add randomness to the value of a keyframe/series of keyframes, but adding it tot the location on the timeline is quite different . . . You will probably need some sort of script. $\endgroup$ – VRM Jan 22 '15 at 19:31
2
$\begingroup$

Yes, there is a way to do this! I'm not confident that it can be done easily through the interface, but if you would like to do it with a script, I've written a sample that can get you going in the right direction. It moves the animation curves one way or the other depending on a random number (randomized per object).

    import bpy, random

    for object in bpy.data.objects:
        rand = random.randrange(-15,stop=15,step=1)
        #only effect objects which include "___" in the name
        if "___" not in object.name:
            continue
        #Go through all the animation curves
        for curve in object.animation_data.action.fcurves:
            #only effect if it's a x location curve (x array_index is 0, y is 1, z is 2...)
            if curve.data_path == 'location' and curve.array_index == 0:
                for point in curve.keyframe_points:
                    #add the random value to the x value (which is the frame #) of the keyframe point and it's handles 
                    point.co.x += rand
                    point.handle_left.x += rand
                    point.handle_right.x += rand

This is just a little bit to get you going. You could change the data_path to affect a different type of animation curve, or change the array index to affect a different parameter of that type of curve.

$\endgroup$

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.