If you get hit, or not, is determined when the cast finishes, NOT when the animation plays. This is the case with almost every skill in the game.