If stuck at bootanimation, just use adb to reboot into recovery (adb reboot recovery) and clear cache. Simple. Is using TWRP, it's self explanatory, on stock recovery, hold power and press volume+. Then select clear cache. Reboot.
For best results though, follow efrant's guide to flash factory image.