theatre-js / theatre

Motion design editor for the web
https://www.theatrejs.com
Apache License 2.0
10.86k stars 338 forks source link

Interpolate Track values on curve #419

Open akre54 opened 1 year ago

akre54 commented 1 year ago

Hi there - I'd like to get all values for a given Track to be able to add a "trail" effect without statefully adding to a list of "seen" values.

Currently the types support a linear interpolator that maps between a beginning and end value, but the result doesn't align with the bezier curve of the timeline's actual keyframes. I'd like to be able to be able to retrieve a value for a given time or a quantized list of values for the whole sequence time, similar to D3's interpolateBasis. Currently it requires a fair bit of hacking in userland. Is this something that could be added to the library?

AriaMinaei commented 1 year ago

This sounds like a great feature to have. Maybe seq.getKeyframes(object.props.x) => Array<Keyframe> or something like that. It's not yet on the roadmap but I'll be happy to merge a PR if one shows up ;)

akre54 commented 1 year ago

Yes I can definitely look into this - finding it a bit tricky to wade through that part of the code but I'll try to whip something up.

akre54 commented 11 months ago

Created: #426