Chande animation speed

How can I change it with script?

Create two states, one at max speed,one at min speed.

Blend them based on a parameter.