Methods and compositions relate to modulating the release profile of drug molecules from a hydrogel by controlling the kinetics of the pH transition of the hydrogel. The hydrogel is formed by in situ polymerization and includes a drug molecule having a pKa between the pH of the formed hydrogel and the physiologic environment in which the hydrogel is placed.