converting keyframe velocity to bezier curves
I'm trying to get a better understanding of the keyframe velocity dialog so that I can convert these keyframe values into Cubic Bezier pairs which could be used in code [for example in CSS cubicBezier(0,0,.3,.7)]
In After Effects each key has two properties. Influence and speed. By combining these two we see the bezier control point that determines the curve.
Influence is easy enough, it determines the X position of the control point. From 0-100% of the distance between keys. This maps directly to to the 0-1 range.
Speed is more difficult. The units depend on the property (pixels/second, percent/second, degrees/second)
The slope of the speed value is the angle of the line drawn between the control point and the key. This angle remains constant no matter what the influence is, and so determines the Y position of the control point.
My question is how do you calculate the slope angle? With that, you could use trig to get the resulting y position of the control point.
or if i'm on the totally wrong track...
How do you convert the speed value to the Y position of the control point?
feels like i'm getting closer to the answer... just not quite there....
Hi, did you get somewhere with this? Are you still looking?
I'm on the same track you are.
I got the answer for one dimensional properties, but I can't figure out how to extend it to multi dimensional ones.
I started here but as far as I know, they made some mistakes.
This is what I got so far. It's a script, not an expression but should be the same. It works with properties like rotation, but not with position, or anchor point.
For multidimensional properties I think the speed should be decomposed into each axis, but I'm not sure how.
I found a script that converts the influence and speed of keyframes into cubic-bezier points here:
It's really helped me out a lot for translating motion curves to web and app developers.
Hi, thanks for sharing. I've seen that post and this only works for one dimesional properties.
If you want to handle multidimensional ones, there are 3 more kinds that need special handling for each case.
PropertyValueType.SHAPE, where average speed is always 1
PropertyValueType.ThreeD, PropertyValueType.TwoD and PropertyValueType.TwoD where each dimensions has its own average speed (this is the more similar to the example)
PropertyValueType.ThreeD_SPATIAL, PropertyValueType.TwoD_SPATIAL, where, to get the average speed, you need to calculate the length of the spatial curve and divide it by the duration.
In addition to that, for the third case, influence in not well reported in some cases, since AE limits this curve as not to have negative values. So, I made a script to find the real influence.
I made an AE to html animation exporter during the last 8 months and I've just shared it on github, if you want to see the code.
It's at https://github.com/bodymovin/bodymovin
There are some examples of animations exported from after effects.
If you're still working on this and want to exchange some ideas, I'd be glad to. It has been a long lonely road to get to this point :)
There is a plug in called FLOW that can create your cubic-bezier