This is usually called A-B sync where the animations of B match up with the origin of A and if you drag and drop the animation clips into world space they will playback and match up to each other.
After that it depends on the context of what it is you want to do.