How to make changing button checked state run animation/transition

Hi,

I’m changing the state of a button remotely (from the network), but the style changes immediately when the checked state is updated. How can I trigger running the animation/transition to fade to the new state like an actual button press does?