One thing I am attempting to do is keyframe functions rather than values. For example, for the first 100 frames I want the y value of an object to use a physics equation of motion. Then for the next 100 frames I want it to be driven by a different function.
I don’t want to do a hacky equation that says if frame<100 do motion equation and frame>100 do 0. I want to use this for extended animations so there might be 30 different functions I want to use for the same attribute on an object.
I am attempting to add a custom property (y_function) that I keyframe with constant values rather than interpolated. Then I would like to write a function that looks like this:
motion( ob.y_function, frame ), and what it does is use the y_function variable to index into a list of equations and return based on frame. thinking about this I would also need a custom property y_offset to find relative frame from when the function was first put on the time line.
So in my animations I could simply add a keyframe on the timeline for y_function that represents the equation to use (maybe a function that is just a switch statement of functions I write in python), and on that same frame set the y_offset to the first frame that equation started being used (so I can get the relative frame).
Is this a complicated way to go about it? A better way maybe?