Transition function generator.