Let's travel back in time in 1995 to look at the motion warping paper. This feature is present in all our software and engine when we want to edit animation. It is the building blocks of the animation layering features and time curve features we have in our editors.
As usual you can find the source code on github : https://github.com/JeromeEippers/AnimationTech