Calculating KeyframeEase Object values

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
bradshaw1965
Posts: 98
Joined: March 14th, 2006, 2:16 pm
Location: Atlanta, GA
Contact:

I'm trying to calculate the attributes for a KeyframeEase object. The attributes in question are speed and influence. Given that I can calculate the 4 components of a bezier curve, calculate points along the curve, and most easily I have the length and pi radians of the control point for a parametric equation, what would be the best way to approach the problem?

I'm guessing speed is the acceleration between the first two points at the terminus of p0 and/or p3? or do I calculate the change in value over time in some other way? Is the influence always just the length of the control point or is it affected by other factors?

Thanks a bunch,

Dale
Dale Bradshaw
Technology Director | Primal Screen
creative-workflow-hacks.com
Atlanta, GA
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

I'm not sure to understand what you're looking for, could you please elaborate further ? (does the keyframe exist already, which property is concerned, etc...)
bradshaw1965
Posts: 98
Joined: March 14th, 2006, 2:16 pm
Location: Atlanta, GA
Contact:

I've got a series of key frames of, in this case, 1-D (scale) values. Each key is represented by a bezier handle. I've got the point, the length of the handle and the rotation of the handle in relationship to the point. I want to reproduce the keyframe ease in After Effects.

I could bake the keys over a given number of points. In the application these keys are coming from the internal values are calculated as 40 points over the duration of the 2 keys. This might take a bit to calculate in Javascript and it would make it difficult to edit.

Ideally, I would recreate the ease curve with a KeyframeEase object, but I can't find the details of how to calculate speed and influence. I can use a heuristic to get a general idea, but, for example, it's not clear to me when and where speed is calculated. I'm a little rusty on my calculus but I think I have an integral and need the derivative? or maybe not.

Either way, just trying to get my head around the problem and I'm not sure which direction to follow.
Dale Bradshaw
Technology Director | Primal Screen
creative-workflow-hacks.com
Atlanta, GA
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

(sorry Dale for my late reply I was super busy :cry: )

okay I see..

I think the speed attribute corresponds to the "slope" of the handle, describing the variation of the property's value over time.
The influence attribute determines the "length" of the handle's projection onto the horizontal line (i.e. the time...line) compared to the "distance" between the considered key and the adjacent key (previous key for incoming velocity, next key for outgoing velocity).

Here is a non-rigorous illustration (and maybe wrong :)) that may help you for your script (note that scale is a 2D or 3D property but I considered a single value in the calculation for clarity):
keyframeEase_01.jpg | keyframeEase_02.jpg

For instance, the built-in "easy ease" command produces a zero speed (the handle is horizontal, slope -or derivative if you prefer- is null) and influence equal to 1/3 (33.33%, this has to do with the definition of Bezier curve, I can explain it but there are many web pages dealing with that..)

ps: is it destined to your FCPtoAE project ?
bradshaw1965
Posts: 98
Joined: March 14th, 2006, 2:16 pm
Location: Atlanta, GA
Contact:

Hey nab,

That's really helpful, thanks. Yep, this is for the FCPToAE project. It's been a great learning experience. I've learnt a ton about Shape Objects, vertices, E4X xml parsing,bezier paths(thanks again), etc. It's always nice to have a big project, that you can break down and have a decently long development cycle.

Best,

Dale
Dale Bradshaw
Technology Director | Primal Screen
creative-workflow-hacks.com
Atlanta, GA
Post Reply