I would like to control the handles of keyframes in the Animation Editor panel with Python and set them programmatically. I don't understand the math behind slope/accel.
To give an example, let's say I want to write a script that automatically finds the right length for handles to be approx. one third of the possible length.
Or a script that maps handle presets to the selected keyframes proportionally. Where could I start?
I was only able to figure out that when the slope is 0, accel can be calculated from .time() alone. But I don't know what slope and accel are mathematically.
Some discoveries if anyone finds this in the future: Slope is tan(angle_in_radians) Accel is the handle's value of the vertical axis, unless approaching slope 0, then it suddenly becomes time in seconds, so the value of the horizontal axis. Maybe it uses max(vertical_value, time)I don't know yet.
I wasn't familiar with this equation, I now see it's a basic distance formula. Very cool! Thanks Tomas. I learned something today. Now I see the slope/accel is just tan and distance.
If you check the source of this tool you can find some math regarding handles and bezier curves.
Link to the tool is on the video description, The video itself is a bit outdated and there are some extra feature added but the core principle is the same, making it easy to manage animation flow on complex paths, I use it a lot to get nice and consistent camera moves and to make nice swoosh effects