Update AnimationHandler.js

Fix for issue #5516 regarding pre-initialized animations.