how do I implement a leaning animation when changing direction?

Hello everyone. This seems like something I should be doing with blendspace, so Im thinking one axis would be speed and the other would determine how much will the character lean and in what direction, but i dont know how to get a value from the change of direction or turnrate. or what value should that axis be and how do I get it from the animation blueprint?

I also have some other questions about locomotion systems, Ive looked on the internet but there doesnt seem to be many tutorials (I havent found any) about locomotion systems beyond the basic stuff. There seems to be a few advanced locomotion systems on the marketplace though, but I dont feel ready to spend money on my proyect yet, even more if its something I could learn myself.

anyone? :confused: