Feature Request: Please Add Keyfrmae Class/Object

Looking through AE UXP API, it’s pretty much the same with what we have in ExtrendScript.
In terms of keyframe handling, we can only use property.keyInSpatialTangent(), property.keyOutSpatialTangent(), ect. Which is not so convenient to use when I need to copy/move the keyframe to another position in time.

To do this, you have to do a lot of things. You have to check all those properties and values in your old keyframe, then create a new keyframe and apply thoes properties and values to your new keyframe, which is a lot of works. And this method also comes with limitation, you can not work with CUSTOM_VALUE_PROPERTY, because you can not read and write its value.

So I am wondering, if we can get a Keyframe Class/Object, const key = new Keyframe(property, index) and on this class, we have key.moveTo(time), key.copyTo(time), etc. Such a class would be a great welcome, it saves lots of work and can go beyond the limitation I metioned before.

So, can we expect to have such features in uxp?

A Keyframe object would definitely be useful, although I could see potential conflicts when moving a keyframe to a time where another keyframe already exists.

I’d also propose adding these methods:

  • valuesAtTimes(times, preExpression)
  • removeKeysAtTimes(times)

We already have setValuesAtTimes() which saves a lot of API calls, but it would be great to retrieve values in bulk with valuesAtTimes(). Removing keyframes also requires looping individual keyframes so removeKeysAtTimes() would be very useful.

Calling valueAtTime() 1000 times can leave After Effects unresponsive until it finishes, even in UXP. A bulk valuesAtTimes() method could significantly improve performance and avoid UI freezes.

A Keyframe object would still be useful for preserving interpolation, easing, tangents, and other keyframe attributes when moving or copying keyframes.

when moving a keyframe to a time where another keyframe already exists

In this situation, I think it’s fine to overwrite the existing keyframe.

And methods you proposed are also great, hope they can be implemented as well.

Thanks for raising the feature request, @MikeSevigny and @dongxi !

We will consider this request for our roadmap and will get back to you if we are able to prioritize it. :raising_hands:

Thanks!Very glad to hear that!