help with doom state edit

Doom state...

<Custom Leave Effect>

user.addState(1);

user.refresh();

user.performCollapse();

</Custom Leave Effect>

how would i edit this to make it show and complete an animation before the second state takes an effect?

E.g 

use the tag on a countdown state

after countdown state ends play an animation then (user.addState(1)

http://yanfly.moe/2015/12/25/yep-50-buffs-states-core/

Original thread: https://forums.rpgmakerweb.com/threads/help-with-doom-state-edit.54344/