Wait script call in battle

So I'm having some scripting issues with a skill I'm working on right now im using yanfly's skill core so I can code in the skill phases and this is what I have

<After Eval>
if(target.mp == 0)
{
Graphics.setCanvasInvert(true, false); //script call from another plugin to invert the screen colors
target.startAnimation(56, false); //plays animation on target
Graphics.setCanvasInvert(false, false); //returns the screen to normal after animation
target.addState(16); // adds debuff state
}
</After Eval>

The problem is that all of the code seems to be executing at almost the same time meaning the script to invert the screen colors and the one to return it to normal cancel each other out and so I want to put a wait between the animation and the script to return the screen to normal color but I can't figure out the script call. If anyone can help I'd really appreciate it.
Spoiler: maybe this will work - list of commands in javascript
@Poryg the wait script call from that list didnt work
Then unless you can set wait commands on the animation, you will not be able to make it this way. Javascript itself doesn't have a native wait function.
@Poryg I got it working using yanfly's action sequences and common events instead thanks for the help

Original thread: https://forums.rpgmakerweb.com/threads/wait-script-call-in-battle.86375/