Keyframe easing using script controller

I'm trying to make a script where I can control easing in and out of keyframes with a script controller, using a slider. So that if I drag the slider one way, the keyframes "attract" the other frames, and if I drag it the other way the keyframes "repel" the other frames.

Hopefully the image below makes it clearer.

Anyone got any ideas how to approach this?